summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBrian Semrau <brian.semrau@gmail.com>2021-10-02 11:00:00 -0400
committerBrian Semrau <brian.semrau@gmail.com>2021-10-04 20:38:08 -0400
commitc18a27a9cd09d9360513969f0faef0b3ae369918 (patch)
tree680576fcfe083c796aacb27729268c86e0834db6 /modules
parent2e8cba0bd9aba40d559368c7cfd01305000a5d00 (diff)
GDScript fix wrong base class assignment
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript_compiler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 9eee0b57f3..34b1e45cdf 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -109,7 +109,9 @@ GDScriptDataType GDScriptCompiler::_gdtype_from_datatype(const GDScriptParser::D
// Locate class by constructing the path to it and following that path
GDScriptParser::ClassNode *class_type = p_datatype.class_type;
if (class_type) {
- if ((!main_script->path.is_empty() && class_type->fqcn.begins_with(main_script->path)) || (!main_script->name.is_empty() && class_type->fqcn.begins_with(main_script->name))) {
+ const bool is_inner_by_path = (!main_script->path.is_empty()) && (class_type->fqcn.split("::")[0] == main_script->path);
+ const bool is_inner_by_name = (!main_script->name.is_empty()) && (class_type->fqcn.split("::")[0] == main_script->name);
+ if (is_inner_by_path || is_inner_by_name) {
// Local class.
List<StringName> names;
while (class_type->outer) {