diff options
author | George Marques <george@gmarqu.es> | 2021-04-23 15:42:33 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2021-04-23 15:42:33 -0300 |
commit | c7511de02e9123aadf4b81d3bef934fab27649e3 (patch) | |
tree | 7ebfd0c50dfe842d61e28797f95bf3dd26b365ab /modules/gdscript/gdscript_compiler.cpp | |
parent | 77a876c6e1c9eb60abbd9ad6f6ba6d9bc0af14e1 (diff) | |
download | redot-engine-c7511de02e9123aadf4b81d3bef934fab27649e3.tar.gz |
GDScript: Fix resolution of dictionary keys
There was a mixup between String and StringName keys. Now they're
clearly separated. This also means you have to consider which type
you're using for the dictionary keys and how you are accessing them.
Diffstat (limited to 'modules/gdscript/gdscript_compiler.cpp')
-rw-r--r-- | modules/gdscript/gdscript_compiler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 7429e3cc0b..060ee7b058 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -680,9 +680,9 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code name = subscript->attribute->name; named = true; } else { - if (subscript->index->type == GDScriptParser::Node::LITERAL && static_cast<const GDScriptParser::LiteralNode *>(subscript->index)->value.get_type() == Variant::STRING) { + if (subscript->index->is_constant && subscript->index->reduced_value.get_type() == Variant::STRING_NAME) { // Also, somehow, named (speed up anyway). - name = static_cast<const GDScriptParser::LiteralNode *>(subscript->index)->value; + name = subscript->index->reduced_value; named = true; } else { // Regular indexing. |