GDScript: Make sure Lua-style dicts use StringName as keys
This commit is contained in:
parent
c7511de02e
commit
1e4ff2ede6
2 changed files with 4 additions and 2 deletions
|
@ -427,8 +427,8 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
|||
}
|
||||
break;
|
||||
case GDScriptParser::DictionaryNode::LUA_TABLE:
|
||||
// Lua-style: key is an identifier interpreted as string.
|
||||
String key = static_cast<const GDScriptParser::IdentifierNode *>(dn->elements[i].key)->name;
|
||||
// Lua-style: key is an identifier interpreted as StringName.
|
||||
StringName key = static_cast<const GDScriptParser::IdentifierNode *>(dn->elements[i].key)->name;
|
||||
element = codegen.add_constant(key);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2440,6 +2440,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_dictionary(ExpressionNode
|
|||
push_error(R"(Expected "=" after dictionary key.)");
|
||||
}
|
||||
}
|
||||
key->is_constant = true;
|
||||
key->reduced_value = static_cast<IdentifierNode *>(key)->name;
|
||||
break;
|
||||
case DictionaryNode::PYTHON_DICT:
|
||||
if (!match(GDScriptTokenizer::Token::COLON)) {
|
||||
|
|
Loading…
Reference in a new issue