v8/test/mjsunit/regress/regress-6142.js
Sathya Gunasekaran cd868618ea [parser] Use better error message to continue a non IterationStatement
BUG=v8:6142

Change-Id: Ia9dff3814fa9d802d94f1769d0f4b5db709a96df
Reviewed-on: https://chromium-review.googlesource.com/459436
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44133}
2017-03-25 22:04:15 +00:00

28 lines
748 B
JavaScript

// Copyright 2016 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.
try {
eval('a: { continue a; }');
assertUnreachable();
} catch(e) {
assertTrue(e instanceof SyntaxError);
assertEquals('Illegal continue statement: \'a\' does not denote an iteration statement', e.message);
}
try {
eval('continue;');
assertUnreachable();
} catch(e) {
assertTrue(e instanceof SyntaxError);
assertEquals('Illegal continue statement: no surrounding iteration statement', e.message);
}
try {
eval('a: { continue b;}');
assertUnreachable();
} catch(e) {
assertTrue(e instanceof SyntaxError);
assertEquals("Undefined label 'b'", e.message);
}