From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
Also required for primary expression tests in next patch. --- dlls/jscript/parser.y | 14 +++++++++++++- dlls/mshtml/tests/es5.js | 5 +++++ 2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 0288577ed29..5f00dbcd1a2 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -244,7 +244,8 @@ static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t %type <identifier> IdentifierName ReservedAsIdentifier ES5Keyword
%nonassoc LOWER_THAN_ELSE -%nonassoc kELSE +%nonassoc kELSE kIN kINSTANCEOF ':' +%nonassoc kGET kLET kSET
%%
@@ -480,6 +481,17 @@ LabelledStatement : tIdentifier ':' Statement { $$ = new_labelled_statement(ctx, @$, $1, $3); }
+ /* We have to lay out the keywords explicitly instead of using Identifier, as otherwise bison's parser + * wouldn't be able to figure out whether to reduce the Identifier or shift the colon (following the + * label and thus treating it as a label). This happens because the parser has only one lookahead token + * that can be used to decide a shift/reduce and would introduce a conflict in this case... */ + | kGET ':' Statement + { $$ = new_labelled_statement(ctx, @$, $1, $3); } + | kSET ':' Statement + { $$ = new_labelled_statement(ctx, @$, $1, $3); } + | kLET ':' Statement + { $$ = new_labelled_statement(ctx, @$, $1, $3); } + /* ECMA-262 3rd Edition 12.11 */ SwitchStatement : kSWITCH left_bracket Expression right_bracket CaseBlock diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index d2ab19e309e..110a1c583fd 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -475,6 +475,11 @@ sync_test("array_sort", function() { sync_test("identifier_keywords", function() { function get(let, set) { } { get /* asdf */: 10 } + let /* block label */ : { + break let; + ok(false, "did not break out of 'let' labelled block statement"); + } + set: var let; var set = 1234; var o = { if: 1,