summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorAdam Scott <ascott.ca@gmail.com>2022-11-23 18:13:13 -0500
committerAdam Scott <ascott.ca@gmail.com>2022-11-25 12:43:55 -0500
commit69bb7e5b1199e6af3256fe948dbfa3102c1ccbc8 (patch)
tree236e44820e52425db97818d259d57104a4ae87ea /modules/gdscript/gdscript_analyzer.cpp
parentfa270c2456df5ad12f51584c4ff891e2cf728cec (diff)
downloadredot-engine-69bb7e5b1199e6af3256fe948dbfa3102c1ccbc8.tar.gz
Fix singleton scene cyclic loading
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 9b0dc9577b..13e44dab48 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -3125,14 +3125,19 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
}
}
} else if (ResourceLoader::get_resource_type(autoload.path) == "PackedScene") {
- Error err = OK;
- Ref<GDScript> scr = GDScriptCache::get_packed_scene_script(autoload.path, err);
- if (err == OK && scr.is_valid()) {
- Ref<GDScriptParserRef> singl_parser = get_parser_for(scr->get_path());
- if (singl_parser.is_valid()) {
- err = singl_parser->raise_status(GDScriptParserRef::INTERFACE_SOLVED);
- if (err == OK) {
- result = type_from_metatype(singl_parser->get_parser()->head->get_datatype());
+ if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(name)) {
+ Variant constant = GDScriptLanguage::get_singleton()->get_named_globals_map()[name];
+ Node *node = Object::cast_to<Node>(constant);
+ if (node != nullptr) {
+ Ref<Script> scr = node->get_script();
+ if (scr.is_valid()) {
+ Ref<GDScriptParserRef> singl_parser = get_parser_for(scr->get_path());
+ if (singl_parser.is_valid()) {
+ Error err = singl_parser->raise_status(GDScriptParserRef::INTERFACE_SOLVED);
+ if (err == OK) {
+ result = type_from_metatype(singl_parser->get_parser()->head->get_datatype());
+ }
+ }
}
}
}