diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-03-06 18:20:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-06 18:20:48 +0100 |
commit | c67e9a4dd4219fd05d9e954263336d63c1dfe2ed (patch) | |
tree | 9117439d738125bc0e65e004bb0906ee3b9e5740 /modules | |
parent | 34a29cb0de1b34d46e2742bd1ea0a3613967e4ed (diff) | |
parent | 9637e427053e359b66fb4b7141b0b237fdb53773 (diff) |
Merge pull request #26665 from bojidar-bg/19704-singleton-constants
Fix enums coming from other classes without preload
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 5619729c13..f005f88d2e 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -815,6 +815,16 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s } if (!dependencies_only) { + if (!bfn && ScriptServer::is_global_class(identifier)) { + Ref<Script> scr = ResourceLoader::load(ScriptServer::get_global_class_path(identifier)); + if (scr.is_valid() && scr->is_valid()) { + ConstantNode *constant = alloc_node<ConstantNode>(); + constant->value = scr; + expr = constant; + bfn = true; + } + } + // Check parents for the constant if (!bfn && cln->extends_file != StringName()) { Ref<GDScript> parent = ResourceLoader::load(cln->extends_file); @@ -7247,6 +7257,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType DataType result; result.has_type = true; result.script_type = scr; + result.is_constant = true; result.is_meta_type = true; Ref<GDScript> gds = scr; if (gds.is_valid()) { @@ -7297,6 +7308,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType if (singleton.is_valid()) { DataType result; result.has_type = true; + result.is_constant = true; result.script_type = singleton; Ref<GDScript> gds = singleton; |