Commit 469754d0 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[parser] Allow same-named labelled blocks in if/else statements

Bug: chromium:917215
Change-Id: Ie2127953a8ce3d6da4feb3478039ba318774e21d
Reviewed-on: https://chromium-review.googlesource.com/c/1404176Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58755}
parent 7ebbe03e
...@@ -4777,7 +4777,13 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseIfStatement( ...@@ -4777,7 +4777,13 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseIfStatement(
StatementT then_statement = impl()->NullStatement(); StatementT then_statement = impl()->NullStatement();
{ {
SourceRangeScope range_scope(scanner(), &then_range); 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(); StatementT else_statement = impl()->NullStatement();
......
// 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; }
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