Add fully_qualified_name for GDScript class

This commit is contained in:
Dani Frank 2020-01-14 17:33:33 +02:00
parent dc0f43a1c2
commit d6f10cd08e
2 changed files with 5 additions and 0 deletions

View file

@ -111,6 +111,7 @@ class GDScript : public Script {
String source;
String path;
String name;
String fully_qualified_name;
SelfList<GDScript> script_list;
GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error);

View file

@ -2131,6 +2131,7 @@ void GDScriptCompiler::_make_scripts(GDScript *p_script, const GDScriptParser::C
}
subclass->_owner = p_script;
subclass->fully_qualified_name = p_script->fully_qualified_name + "::" + name;
p_script->subclasses.insert(name, subclass);
_make_scripts(subclass.ptr(), p_class->subclasses[i], false);
@ -2149,6 +2150,9 @@ Error GDScriptCompiler::compile(const GDScriptParser *p_parser, GDScript *p_scri
source = p_script->get_path();
// The best fully qualified name for a base level script is its file path
p_script->fully_qualified_name = p_script->path;
// Create scripts for subclasses beforehand so they can be referenced
_make_scripts(p_script, static_cast<const GDScriptParser::ClassNode *>(root), p_keep_state);