Enable singletons to be recognized as constant expressions

Fix #14681
This commit is contained in:
George Marques 2018-05-28 13:38:35 -03:00
parent c8a799d691
commit 38284bc6da
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D

View file

@ -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) {