[parser] Fix SyntaxError in case of eval of for-of conflicting with catch variable

Bug: v8:4231
Change-Id: I833ef23d32a27a403fe733e17f6ff1aa182c39b1
Reviewed-on: https://chromium-review.googlesource.com/c/1430701
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59079}
This commit is contained in:
Toon Verwaest 2019-01-23 18:00:33 +01:00 committed by Commit Bot
parent c70001ae71
commit 22ad8d4f35
2 changed files with 2 additions and 4 deletions

View File

@ -1195,7 +1195,8 @@ class ParserBase {
if (is_for_var_of) {
Scope* scope = this->scope();
while (scope != nullptr && !scope->is_declaration_scope()) {
while (!scope->is_declaration_scope() ||
(scope->is_eval_scope() && is_sloppy(scope->language_mode()))) {
if (scope->is_catch_scope()) {
auto name = scope->catch_variable()->raw_name();
// If it's a simple binding and the name is declared in the for loop.

View File

@ -138,9 +138,6 @@
'built-ins/DataView/prototype/byteLength/detached-buffer': [FAIL],
'built-ins/DataView/prototype/byteOffset/detached-buffer': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4231
'language/eval-code/direct/var-env-lower-lex-catch-non-strict': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4951
'language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order': [FAIL],
'language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order': [FAIL],