[parser] Allow same-named labelled blocks in if/else statements
Bug: chromium:917215 Change-Id: Ie2127953a8ce3d6da4feb3478039ba318774e21d Reviewed-on: https://chromium-review.googlesource.com/c/1404176 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Adam Klein <adamk@chromium.org> Cr-Commit-Position: refs/heads/master@{#58755}
This commit is contained in:
parent
7ebbe03e08
commit
469754d01c
@ -4777,7 +4777,13 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseIfStatement(
|
||||
StatementT then_statement = impl()->NullStatement();
|
||||
{
|
||||
SourceRangeScope range_scope(scanner(), &then_range);
|
||||
then_statement = ParseScopedStatement(labels);
|
||||
// Make a copy of {labels} to avoid conflicts with any
|
||||
// labels that may be applied to the else clause below.
|
||||
auto labels_copy =
|
||||
labels == nullptr
|
||||
? labels
|
||||
: new (zone()) ZonePtrList<const AstRawString>(*labels, zone());
|
||||
then_statement = ParseScopedStatement(labels_copy);
|
||||
}
|
||||
|
||||
StatementT else_statement = impl()->NullStatement();
|
||||
|
6
test/mjsunit/regress/regress-917215.js
Normal file
6
test/mjsunit/regress/regress-917215.js
Normal file
@ -0,0 +1,6 @@
|
||||
// Copyright 2019 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.
|
||||
|
||||
a: if (true) b: { break a; break b; }
|
||||
else b: { break a; break b; }
|
Loading…
Reference in New Issue
Block a user