v8/test/mjsunit/harmony/optional-catch-binding-breaks.js
Mathias Bynens 0a237ffe5b Remove always-true --harmony-optional-catch-binding runtime flag
It was shipped in Chrome 66.

Bug: v8:6889
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I6333ee20ab913b281674b911d525d2851f4694c9
Reviewed-on: https://chromium-review.googlesource.com/1086928
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53527}
2018-06-05 16:24:20 +00:00

64 lines
1.2 KiB
JavaScript

// Copyright 2017 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.
let state = 'initial';
x: try {
throw new Error('caught');
state = 'unreachable';
} catch {
assertEquals(state, 'initial');
state = 'caught';
break x;
state = 'unreachable';
}
assertEquals(state, 'caught');
state = 'initial';
x: try {
throw new Error('caught');
state = 'unreachable';
} catch {
assertEquals(state, 'initial');
state = 'caught';
break x;
state = 'unreachable';
} finally {
assertEquals(state, 'caught');
state = 'finally';
}
assertEquals(state, 'finally');
state = 'initial';
x: {
y: try {
throw new Error('caught');
state = 'unreachable';
} catch {
assertEquals(state, 'initial');
state = 'caught';
break x;
state = 'unreachable';
} finally {
assertEquals(state, 'caught');
state = 'finally';
break y;
state = 'unreachable';
}
assertEquals(state, 'finally');
state = 'after block';
}
assertEquals(state, 'after block');
do {
try {
throw new Error();
} catch {
break;
}
assertUnreachable();
} while(false);