summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2020-08-24 09:15:33 -0300
committerGeorge Marques <george@gmarqu.es>2020-08-24 09:15:33 -0300
commit722be9aaef2746033f3a46c9a6349be7545918f9 (patch)
treec82a9cd0967e51a3e95d9ef05ab86815c5cb2759 /modules/gdscript
parentca90c9c9a93a51bb8afeb0fa9010c750a57fee56 (diff)
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.
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_compiler.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index e34d87f5cc..1631fa11bb 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/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;
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;