From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/parser.y | 23 +++++++++++++++-------- dlls/mshtml/tests/es5.js | 7 +++++-- 2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 42d695e0846..d557588a5c5 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -221,7 +221,7 @@ static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t %type <expr> MemberExpression %type <expr> PrimaryExpression %type <expr> GetterSetterMethod -%type <identifier> Identifier_opt +%type <identifier> Identifier Identifier_opt %type <variable_list> VariableDeclarationList %type <variable_list> VariableDeclarationListNoIn %type <variable_declaration> VariableDeclaration @@ -241,7 +241,7 @@ static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t %type <literal> PropertyName %type <literal> BooleanLiteral %type <ival> AssignOper -%type <identifier> IdentifierName ReservedAsIdentifier +%type <identifier> IdentifierName ReservedAsIdentifier ES5Keyword
%nonassoc LOWER_THAN_ELSE %nonassoc kELSE @@ -381,12 +381,12 @@ VariableDeclarationListNoIn
/* ECMA-262 3rd Edition 12.2 */ VariableDeclaration - : tIdentifier Initialiser_opt + : Identifier Initialiser_opt { $$ = new_variable_declaration(ctx, $1, $2); }
/* ECMA-262 3rd Edition 12.2 */ VariableDeclarationNoIn - : tIdentifier InitialiserNoIn_opt + : Identifier InitialiserNoIn_opt { $$ = new_variable_declaration(ctx, $1, $2); }
/* ECMA-262 3rd Edition 12.2 */ @@ -860,7 +860,11 @@ PropertyName /* ECMA-262 3rd Edition 7.6 */ Identifier_opt : /* empty*/ { $$ = NULL; } - | tIdentifier { $$ = $1; } + | Identifier { $$ = $1; } + +Identifier + : tIdentifier { $$ = $1; } + | ES5Keyword { $$ = $1; }
/* ECMA-262 5.1 Edition 7.6 */ IdentifierName @@ -890,15 +894,12 @@ ReservedAsIdentifier | kFINALLY { $$ = $1; } | kFOR { $$ = $1; } | kFUNCTION { $$ = $1; } - | kGET { $$ = $1; } | kIF { $$ = $1; } | kIN { $$ = $1; } | kINSTANCEOF { $$ = $1; } - | kLET { $$ = $1; } | kNEW { $$ = $1; } | kNULL { $$ = $1; } | kRETURN { $$ = $1; } - | kSET { $$ = $1; } | kSWITCH { $$ = $1; } | kTHIS { $$ = $1; } | kTHROW { $$ = $1; } @@ -909,6 +910,12 @@ ReservedAsIdentifier | kVOID { $$ = $1; } | kWHILE { $$ = $1; } | kWITH { $$ = $1; } + | ES5Keyword { $$ = $1; } + +ES5Keyword + : kGET { $$ = $1; } + | kLET { $$ = $1; } + | kSET { $$ = $1; }
/* ECMA-262 3rd Edition 7.8 */ Literal diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 18b106e2a82..70003761133 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -473,6 +473,8 @@ sync_test("array_sort", function() { });
sync_test("identifier_keywords", function() { + { get /* asdf */: 10 } + var set = 1234; var o = { if: 1, default: 2, @@ -486,8 +488,8 @@ sync_test("identifier_keywords", function() { else: true, finally: true, for: true, - in: true, - instanceof: true, + set in(x) { }, + get instanceof() { return 3; }, new: true, return: true, switch: true, @@ -508,6 +510,7 @@ sync_test("identifier_keywords", function() { ok(o.if === 1, "o.if = " + o.if); ok(ro().default === 2, "ro().default = " + ro().default); ok(o.false === true, "o.false = " + o.false); + ok(o.instanceof === 3, "o.instanceof = " + o.instanceof); });
function test_own_data_prop_desc(obj, prop, expected_writable, expected_enumerable,