summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/harmony/optional-catch-binding.js
blob: eaedc82a42e5f87a8626cb8c0930372dda147743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 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';
try {
  throw new Error('caught');
  state = 'unreachable';
} catch { // Note the lack of a binding
  assertEquals(state, 'initial');
  state = 'caught';
}
assertEquals(state, 'caught');


let sigil1 = {};
try {
  throw sigil1;
} catch (e) {
  assertEquals(e, sigil1);
}


let sigil2 = {};
let reached = false;
try {
  try {
    throw sigil1;
  } catch {
    reached = true;
  } finally {
    throw sigil2;
  }
} catch (e) {
  assertEquals(e, sigil2);
}
assertTrue(reached);