You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
GDScript: Make sure Lua-style dicts use StringName as keys
This commit is contained in:
@@ -427,8 +427,8 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GDScriptParser::DictionaryNode::LUA_TABLE:
|
case GDScriptParser::DictionaryNode::LUA_TABLE:
|
||||||
// Lua-style: key is an identifier interpreted as string.
|
// Lua-style: key is an identifier interpreted as StringName.
|
||||||
String key = static_cast<const GDScriptParser::IdentifierNode *>(dn->elements[i].key)->name;
|
StringName key = static_cast<const GDScriptParser::IdentifierNode *>(dn->elements[i].key)->name;
|
||||||
element = codegen.add_constant(key);
|
element = codegen.add_constant(key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2440,6 +2440,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_dictionary(ExpressionNode
|
|||||||
push_error(R"(Expected "=" after dictionary key.)");
|
push_error(R"(Expected "=" after dictionary key.)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
key->is_constant = true;
|
||||||
|
key->reduced_value = static_cast<IdentifierNode *>(key)->name;
|
||||||
break;
|
break;
|
||||||
case DictionaryNode::PYTHON_DICT:
|
case DictionaryNode::PYTHON_DICT:
|
||||||
if (!match(GDScriptTokenizer::Token::COLON)) {
|
if (!match(GDScriptTokenizer::Token::COLON)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user