summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-14 18:54:52 +0100
committerGitHub <noreply@github.com>2020-01-14 18:54:52 +0100
commit3d88a7bb22825025ee505b281fd92eb2c7d3cd2f (patch)
tree815d61ef0b86429cb01d6e6253dd5ffd81559d98
parent16860e90f1e19b2bd1059e0c7032e9ab3c25e319 (diff)
parentd6f10cd08e795cdbf5fcf07149b584c47a236cf4 (diff)
Merge pull request #35122 from ChibiDenDen/fully_qualified_name_gdscript
Add fully_qualified_name for GDScript class
-rw-r--r--modules/gdscript/gdscript.h1
-rw-r--r--modules/gdscript/gdscript_compiler.cpp4
2 files changed, 5 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 72389cdddc..0e2b812a22 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -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);
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 7b3175d9cd..711fa54d0b 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -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);