diff options
author | George Marques <george@gmarqu.es> | 2018-09-10 10:31:36 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2018-09-19 11:17:46 -0300 |
commit | b5300314426dacff2f8cd4bd76ecb61528f3d899 (patch) | |
tree | a6779110d939fc3ef030769a56b72772da15bc6d /modules | |
parent | 4907a1cd284adcbe178aeedb84c2028ae54a78cd (diff) |
GDScript: Allow Object constants to be used with qualifier
Fix #15125
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 81652c3d37..aa1735522b 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -637,9 +637,21 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s expr = op; } else { - - _set_error("Static constant '" + identifier.operator String() + "' not present in built-in type " + Variant::get_type_name(bi_type) + "."); - return NULL; + // Object is a special case + bool valid = false; + if (bi_type == Variant::OBJECT) { + int object_constant = ClassDB::get_integer_constant("Object", identifier, &valid); + if (valid) { + ConstantNode *cn = alloc_node<ConstantNode>(); + cn->value = object_constant; + cn->datatype = _type_from_variant(cn->value); + expr = cn; + } + } + if (!valid) { + _set_error("Static constant '" + identifier.operator String() + "' not present in built-in type " + Variant::get_type_name(bi_type) + "."); + return NULL; + } } } else { |