Browse Source

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.
George Marques 5 years ago
parent
commit
722be9aaef
1 changed files with 1 additions and 5 deletions
  1. 1 5
      modules/gdscript/gdscript_compiler.cpp

+ 1 - 5
modules/gdscript/gdscript_compiler.cpp

@@ -2696,11 +2696,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
 				const GDScriptParser::ConstantNode *constant = member.constant;
 				const GDScriptParser::ConstantNode *constant = member.constant;
 				StringName name = constant->identifier->name;
 				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
 #ifdef TOOLS_ENABLED
 
 
 				p_script->member_lines[name] = constant->start_line;
 				p_script->member_lines[name] = constant->start_line;