Commit 2a6c0f4a authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[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: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65602}
parent bfd16238
...@@ -1187,7 +1187,7 @@ Declaration* DeclarationScope::CheckConflictingVarDeclarations() { ...@@ -1187,7 +1187,7 @@ Declaration* DeclarationScope::CheckConflictingVarDeclarations() {
// anything, so we can't conflict with anything either. The one // anything, so we can't conflict with anything either. The one
// exception is the binding variable in catch scopes, which is handled // exception is the binding variable in catch scopes, which is handled
// by the if above. // by the if above.
if (!IsLexicalVariableMode(other_var->mode())) return nullptr; if (!IsLexicalVariableMode(other_var->mode())) break;
return decl; return decl;
} }
current = current->outer_scope(); current = current->outer_scope();
......
// 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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment