Merge pull request #35122 from ChibiDenDen/fully_qualified_name_gdscript

Add fully_qualified_name for GDScript class
This commit is contained in:
Rémi Verschelde 2020-01-14 18:54:52 +01:00 committed by GitHub
commit 3d88a7bb22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);