• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright JS Foundation and other contributors, http://js.foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15var a = 1;
16
17function f() {
18  throw ++a;
19}
20
21function g() {
22  f();
23}
24
25function h() {
26  g();
27}
28
29try {
30  h();
31} catch (e) {
32  ++a;
33}
34
35try {
36  h();
37} catch (e) {
38  ++a;
39
40  try {
41    throw "Catch again";
42  } catch (e) {
43    ++a;
44  }
45}
46
47try {
48  try {
49    h();
50  } finally {
51    ++a;
52  }
53  ++a; /* Should not happen. */
54} catch (e) {
55  ++a;
56}
57
58try {
59  try {
60    h();
61  } finally {
62    ++a;
63    throw "Replace the other error";
64  }
65} catch (e) {
66  ++a;
67}
68
69try {
70  break_try_label: try {
71    h();
72  } finally {
73    ++a;
74    break break_try_label;
75  }
76  throw "Should be caught";
77} catch (e) {
78  ++a;
79}
80
81h();
82