summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_parser.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-18 23:08:01 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-18 23:08:01 +0100
commit80b3813b1505a6bd195c0b0aac1555a7969e59c9 (patch)
tree26f4adcebb64ec985f6193e73d7adb45b9c8965d /modules/gdscript/gdscript_parser.cpp
parenta66fc4cf7ebd155ee475bc69863b47081119d965 (diff)
parent5704055d30499cc63672d44001760a98abfbfc08 (diff)
Merge pull request #67714 from adamscott/fix-preload-cyclic-references-part2
Fix cyclic references in GDScript 2.0
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r--modules/gdscript/gdscript_parser.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 053d81893d..ce14b412c7 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -648,7 +648,13 @@ GDScriptParser::ClassNode *GDScriptParser::parse_class() {
if (consume(GDScriptTokenizer::Token::IDENTIFIER, R"(Expected identifier for the class name after "class".)")) {
n_class->identifier = parse_identifier();
if (n_class->outer) {
- n_class->fqcn = n_class->outer->fqcn + "::" + n_class->identifier->name;
+ String fqcn = n_class->outer->fqcn;
+ if (fqcn.is_empty()) {
+ fqcn = script_path;
+ }
+ n_class->fqcn = fqcn + "::" + n_class->identifier->name;
+ } else {
+ n_class->fqcn = n_class->identifier->name;
}
}