[parser] Fix conflict detection loop early exit
During conflict detection, we want to early exit the scope loop when we find a non-conflict, but continue looking at the other declarations in the scope. Bug: chromium:1038588 Change-Id: Ia2a19b02222fbd13cec70d3a60d2f5bae4ce245b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1985991 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/master@{#65602}
This commit is contained in:
parent
bfd16238ea
commit
2a6c0f4acf
@ -1187,7 +1187,7 @@ Declaration* DeclarationScope::CheckConflictingVarDeclarations() {
|
||||
// anything, so we can't conflict with anything either. The one
|
||||
// exception is the binding variable in catch scopes, which is handled
|
||||
// by the if above.
|
||||
if (!IsLexicalVariableMode(other_var->mode())) return nullptr;
|
||||
if (!IsLexicalVariableMode(other_var->mode())) break;
|
||||
return decl;
|
||||
}
|
||||
current = current->outer_scope();
|
||||
|
9
test/mjsunit/regress/regress-1038588.js
Normal file
9
test/mjsunit/regress/regress-1038588.js
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright 2020 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
function foo(arg){
|
||||
const x = 0;
|
||||
eval("var arg, x;");
|
||||
}
|
||||
assertThrows(foo, SyntaxError);
|
Loading…
Reference in New Issue
Block a user