260af115c2
In order to know which labels are valid continue targets, we must track the labels that immediately prefix an iteration statement. Also document some things that I had to figure out. Bug: v8:8033 Change-Id: Ia8288fd0e553a547aa0f9d1b4381bb103325bc3a Reviewed-on: https://chromium-review.googlesource.com/1172292 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#55110}
46 lines
3.0 KiB
JavaScript
46 lines
3.0 KiB
JavaScript
// Copyright 2018 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.
|
|
|
|
assertThrows("foo: if (true) do { continue foo } while (false)", SyntaxError);
|
|
assertThrows("foo: if (true) while (false) { continue foo }", SyntaxError);
|
|
assertThrows("foo: if (true) for (; false; ) { continue foo }", SyntaxError);
|
|
assertThrows("foo: if (true) for (let x of []) { continue foo }", SyntaxError);
|
|
assertThrows("foo: if (true) for (let x in []) { continue foo }", SyntaxError);
|
|
|
|
assertThrows("foo: if (true) { do { continue foo } while (false) }", SyntaxError);
|
|
assertThrows("foo: if (true) { while (false) { continue foo } }", SyntaxError);
|
|
assertThrows("foo: if (true) { for (; false; ) { continue foo } }", SyntaxError);
|
|
assertThrows("foo: if (true) { for (let x of []) { continue foo } }", SyntaxError);
|
|
assertThrows("foo: if (true) { for (let x in []) { continue foo } }", SyntaxError);
|
|
|
|
assertThrows("foo: goo: if (true) do { continue foo } while (false)", SyntaxError);
|
|
assertThrows("foo: goo: if (true) while (false) { continue foo }", SyntaxError);
|
|
assertThrows("foo: goo: if (true) for (; false; ) { continue foo }", SyntaxError);
|
|
assertThrows("foo: goo: if (true) for (let x of []) { continue foo }", SyntaxError);
|
|
assertThrows("foo: goo: if (true) for (let x in []) { continue foo }", SyntaxError);
|
|
|
|
assertThrows("foo: goo: if (true) { do { continue foo } while (false) }", SyntaxError);
|
|
assertThrows("foo: goo: if (true) { while (false) { continue foo } }", SyntaxError);
|
|
assertThrows("foo: goo: if (true) { for (; false; ) { continue foo } }", SyntaxError);
|
|
assertThrows("foo: goo: if (true) { for (let x of []) { continue foo } }", SyntaxError);
|
|
assertThrows("foo: goo: if (true) { for (let x in []) { continue foo } }", SyntaxError);
|
|
|
|
assertDoesNotThrow("if (true) foo: goo: do { continue foo } while (false)");
|
|
assertDoesNotThrow("if (true) foo: goo: while (false) { continue foo }");
|
|
assertDoesNotThrow("if (true) foo: goo: for (; false; ) { continue foo }");
|
|
assertDoesNotThrow("if (true) foo: goo: for (let x of []) { continue foo }");
|
|
assertDoesNotThrow("if (true) foo: goo: for (let x in []) { continue foo }");
|
|
|
|
assertThrows("if (true) foo: goo: { do { continue foo } while (false) }", SyntaxError);
|
|
assertThrows("if (true) foo: goo: { while (false) { continue foo } }", SyntaxError);
|
|
assertThrows("if (true) foo: goo: { for (; false; ) { continue foo } }", SyntaxError);
|
|
assertThrows("if (true) foo: goo: { for (let x of []) { continue foo } }", SyntaxError);
|
|
assertThrows("if (true) foo: goo: { for (let x in []) { continue foo } }", SyntaxError);
|
|
|
|
assertDoesNotThrow("if (true) { foo: goo: do { continue foo } while (false) }");
|
|
assertDoesNotThrow("if (true) { foo: goo: while (false) { continue foo } }");
|
|
assertDoesNotThrow("if (true) { foo: goo: for (; false; ) { continue foo } }");
|
|
assertDoesNotThrow("if (true) { foo: goo: for (let x of []) { continue foo } }");
|
|
assertDoesNotThrow("if (true) { foo: goo: for (let x in []) { continue foo } }");
|