summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2018-05-28 13:38:35 -0300
committerGeorge Marques <george@gmarqu.es>2018-05-28 13:40:16 -0300
commit38284bc6da801dcc0e1a6b47580a20b5ade32f06 (patch)
tree55b022b8fc688d4618ba9b9d6c3dd71c3ff0853e /modules/gdscript
parentc8a799d6918f2c5dbbf7084ef681fcd016c79d3d (diff)
Enable singletons to be recognized as constant expressions
Fix #14681
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_parser.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index e7b0700e76..5e93b377d2 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -716,6 +716,14 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
expr = constant;
bfn = true;
}
+
+ if (!bfn && GDScriptLanguage::get_singleton()->get_named_globals_map().has(identifier)) {
+ //check from singletons
+ ConstantNode *constant = alloc_node<ConstantNode>();
+ constant->value = GDScriptLanguage::get_singleton()->get_named_globals_map()[identifier];
+ expr = constant;
+ bfn = true;
+ }
}
if (!bfn) {