GDScript: Don't fail to load constants if they're not a literal

It's still okay as long as it's a constant value. This should already
been validated by the analyzer.
This commit is contained in:
George Marques 2020-08-24 09:15:33 -03:00
parent ca90c9c9a9
commit 722be9aaef
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D

View file

@ -2696,11 +2696,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
const GDScriptParser::ConstantNode *constant = member.constant;
StringName name = constant->identifier->name;
ERR_CONTINUE(constant->initializer->type != GDScriptParser::Node::LITERAL);
const GDScriptParser::LiteralNode *literal = static_cast<const GDScriptParser::LiteralNode *>(constant->initializer);
p_script->constants.insert(name, literal->value);
p_script->constants.insert(name, constant->initializer->reduced_value);
#ifdef TOOLS_ENABLED
p_script->member_lines[name] = constant->start_line;