From 38284bc6da801dcc0e1a6b47580a20b5ade32f06 Mon Sep 17 00:00:00 2001 From: George Marques Date: Mon, 28 May 2018 13:38:35 -0300 Subject: [PATCH] Enable singletons to be recognized as constant expressions Fix #14681 --- modules/gdscript/gdscript_parser.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index e7b0700e768..5e93b377d29 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(); + constant->value = GDScriptLanguage::get_singleton()->get_named_globals_map()[identifier]; + expr = constant; + bfn = true; + } } if (!bfn) {