Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
Anything that imports prototype.js needs this.
dlls/jscript/parser.y | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 0ebdc2b..e44f20e 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -220,7 +220,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 @@ -267,9 +267,9 @@ FunctionStatementList FunctionExpression : kFUNCTION left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' { $$ = new_function_expression(ctx, NULL, $3, $6, NULL, ctx->begin + @1, @7 - @1 + 1); } - | kFUNCTION tIdentifier left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' + | kFUNCTION Identifier left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' { $$ = new_function_expression(ctx, $2, $4, $7, NULL, ctx->begin + @1, @8 - @1 + 1); } - | kFUNCTION tIdentifier kDCOL tIdentifier left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' + | kFUNCTION Identifier kDCOL Identifier left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' { $$ = new_function_expression(ctx, $4, $6, $9, $2, ctx->begin + @1, @10 - @1 + 1); }
/* ECMA-262 10th Edition 14.1 */ @@ -278,8 +278,8 @@ FunctionBody
/* ECMA-262 3rd Edition 13 */ FormalParameterList - : tIdentifier { $$ = new_parameter_list(ctx, $1); } - | FormalParameterList ',' tIdentifier + : Identifier { $$ = new_parameter_list(ctx, $1); } + | FormalParameterList ',' Identifier { $$ = parameter_list_add(ctx, $1, $3); }
/* ECMA-262 3rd Edition 13 */ @@ -380,12 +380,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 */ @@ -476,7 +476,7 @@ WithStatement
/* ECMA-262 3rd Edition 12.12 */ LabelledStatement - : tIdentifier ':' Statement + : Identifier ':' Statement { $$ = new_labelled_statement(ctx, @$, $1, $3); }
/* ECMA-262 3rd Edition 12.11 */ @@ -526,7 +526,7 @@ TryStatement
/* ECMA-262 3rd Edition 12.14 */ Catch - : kCATCH left_bracket tIdentifier right_bracket Block + : kCATCH left_bracket Identifier right_bracket Block { $$ = new_catch_block(ctx, $3, $5); }
/* ECMA-262 3rd Edition 12.14 */ @@ -785,7 +785,7 @@ ArgumentList /* ECMA-262 3rd Edition 11.1 */ PrimaryExpression : kTHIS { $$ = new_expression(ctx, EXPR_THIS, 0); } - | tIdentifier { $$ = new_identifier_expression(ctx, $1); } + | Identifier { $$ = new_identifier_expression(ctx, $1); } | Literal { $$ = new_literal_expression(ctx, $1); } | ArrayLiteral { $$ = $1; } | ObjectLiteral { $$ = $1; } @@ -859,7 +859,13 @@ PropertyName /* ECMA-262 3rd Edition 7.6 */ Identifier_opt : /* empty*/ { $$ = NULL; } - | tIdentifier { $$ = $1; } + | Identifier { $$ = $1; } + +Identifier + : tIdentifier { $$ = $1; } + | kGET { $$ = $1; } + | kLET { $$ = $1; } + | kSET { $$ = $1; }
/* ECMA-262 5.1 Edition 7.6 */ IdentifierName
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/tests/es5.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 81c06a4..ee10ee5 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -202,7 +202,13 @@ sync_test("array_sort", function() { });
sync_test("identifier_keywords", function() { + function get(let, set) { return let + set; } + set: var let = get(1, 2); + var set = 0; var o = { + get: get, + set: set, + let: let, if: 1, default: 2, function: 3, @@ -237,6 +243,15 @@ 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); + + var tmp = false; + try { + eval('function var() { }'); + } + catch(set) { + tmp = true; + } + ok(tmp === true, "Expected exception for 'function var() { }'"); });
function test_own_data_prop_desc(obj, prop, expected_writable, expected_enumerable,
Hi Gabriel,
On 8/27/21 4:47 PM, Gabriel Ivăncescu wrote:
Signed-off-by: Gabriel Ivăncescugabrielopcode@gmail.com
Anything that imports prototype.js needs this.
dlls/jscript/parser.y | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
The patch introduces a few new bison warnings, please try to avoid them.
Thanks,
Jacek