1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

fix access to identifiers that are reserved keywords

This commit is contained in:
ajreckof
2023-04-05 19:52:01 +02:00
parent 44d539465a
commit ab9f60dd1a
3 changed files with 40 additions and 0 deletions

View File

@@ -2820,6 +2820,9 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_attribute(ExpressionNode *
attribute->base = p_previous_operand; attribute->base = p_previous_operand;
if (current.is_node_name()) {
current.type = GDScriptTokenizer::Token::IDENTIFIER;
}
if (!consume(GDScriptTokenizer::Token::IDENTIFIER, R"(Expected identifier after "." for attribute access.)")) { if (!consume(GDScriptTokenizer::Token::IDENTIFIER, R"(Expected identifier after "." for attribute access.)")) {
complete_extents(attribute); complete_extents(attribute);
return attribute; return attribute;

View File

@@ -0,0 +1,36 @@
var dict = {}
func test():
dict.if = 1
dict.elif = 1
dict.else = 1
dict.for = 1
dict.while = 1
dict.match = 1
dict.break = 1
dict.continue = 1
dict.pass = 1
dict.return = 1
dict.class = 1
dict.class_name = 1
dict.extends = 1
dict.is = 1
dict.in = 1
dict.as = 1
dict.self = 1
dict.signal = 1
dict.func = 1
dict.static = 1
dict.const = 1
dict.enum = 1
dict.var = 1
dict.breakpoint = 1
dict.preload = 1
dict.await = 1
dict.yield = 1
dict.assert = 1
dict.void = 1
dict.PI = 1
dict.TAU = 1
dict.INF = 1
dict.NAN = 1