Debian Codegraph @

rhino/testsrc/tests/js1_7/extensions/regress-350312.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = 'regress-350312.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 350312;
9 var summary = 'Accessing wrong stack slot with nested catch/finally';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 var iter;
25 function gen()
26 {
27 try {
28 yield iter;
29 } catch (e if e == null) {
30 actual += 'CATCH,';
31 print("CATCH");
32 } finally {
33 actual += 'FINALLY';
34 print("FINALLY");
35 }
36 }
37
38 expect = 'FINALLY';
39 actual = '';
40 (iter = gen()).next().close();
41 reportCompare(expect, actual, summary);
42
43 expect = 'FINALLY';
44 actual = '';
45 try
46 {
47 (iter = gen()).next().throw(1);
48 }
49 catch(ex)
50 {
51 }
52 reportCompare(expect, actual, summary);
53
54 expect = 'CATCH,FINALLY';
55 actual = '';
56 try
57 {
58 (iter = gen()).next().throw(null);
59 }
60 catch(ex)
61 {
62 }
63 reportCompare(expect, actual, summary);
64
65 expect = 'FINALLY';
66 actual = '';
67 var expectexcp = '[object StopIteration]';
68 var actualexcp = '';
69 try
70 {
71 (iter = gen()).next().next();
72 }
73 catch(ex)
74 {
75 actualexcp = ex + '';
76 }
77 reportCompare(expect, actual, summary);
78 reportCompare(expectexcp, actualexcp, summary);
79
80 exitFunc ('test');
81 }