|
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 //----------------------------------------------------------------------------- |
|
7 var BUGNUMBER = 452498; |
|
8 var summary = 'TM: upvar2 regression tests'; |
|
9 var actual = ''; |
|
10 var expect = ''; |
|
11 |
|
12 |
|
13 //----------------------------------------------------------------------------- |
|
14 test(); |
|
15 //----------------------------------------------------------------------------- |
|
16 |
|
17 function test() |
|
18 { |
|
19 enterFunc ('test'); |
|
20 printBugNumber(BUGNUMBER); |
|
21 printStatus (summary); |
|
22 |
|
23 // ------- Comment #117 From Gary Kwong [:nth10sd] |
|
24 |
|
25 // The following all do not require -j. |
|
26 |
|
27 // ===== |
|
28 |
|
29 try |
|
30 { |
|
31 eval('x; function x(){}; const x;'); |
|
32 } |
|
33 catch(ex) |
|
34 { |
|
35 } |
|
36 |
|
37 // Assertion failure: !pn->isPlaceholder(), at ../jsparse.cpp:4876 |
|
38 // ===== |
|
39 (function(){ var x; eval("var x; x = null"); })(); |
|
40 |
|
41 // Assertion failure: !(pnu->pn_dflags & PND_BOUND), at ../jsemit.cpp:1818 |
|
42 // ===== |
|
43 (function(){const x = 0, y = delete x;})() |
|
44 |
|
45 // Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710 |
|
46 // ===== |
|
47 try |
|
48 { |
|
49 (function(){(yield []) (function(){with({}){x} }); const x;})(); |
|
50 } |
|
51 catch(ex) |
|
52 { |
|
53 } |
|
54 |
|
55 // Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:2022 |
|
56 // ===== |
|
57 try |
|
58 { |
|
59 (function(){([]) ((function(q) { return q; })for (each in [1,2]))})(); |
|
60 } |
|
61 catch(ex) |
|
62 { |
|
63 } |
|
64 // Assertion failure: lexdep->frameLevel() <= funbox->level, at ../jsparse.cpp:1782 |
|
65 // Opt crash [@ JSCompiler::setFunctionKinds] near null |
|
66 // ===== |
|
67 |
|
68 try |
|
69 { |
|
70 eval("((x1) > [(x)(function() { x;}) for each (x in x)])()"); |
|
71 } |
|
72 catch(ex) |
|
73 { |
|
74 } |
|
75 |
|
76 // Assertion failure: pnu->pn_lexdef == dn, at ../jsemit.cpp:1817 |
|
77 // ===== |
|
78 uneval(function(){for(var [arguments] = ({ get y(){} }) in y ) (x);}); |
|
79 |
|
80 // Assertion failure: n != 0, at ../jsfun.cpp:2689 |
|
81 // ===== |
|
82 try |
|
83 { |
|
84 eval('(function(){{for(c in (function (){ for(x in (x1))window} )()) {const x;} }})();'); |
|
85 } |
|
86 catch(ex) |
|
87 { |
|
88 } |
|
89 |
|
90 // Assertion failure: op == JSOP_GETLOCAL, at ../jsemit.cpp:4557 |
|
91 // ===== |
|
92 try |
|
93 { |
|
94 (eval("(function(){let x , x = (x for (x in null))});"))(); |
|
95 } |
|
96 catch(ex) |
|
97 { |
|
98 } |
|
99 |
|
100 // Assertion failure: (fun->u.i.script)->upvarsOffset != 0, at ../jsfun.cpp:1537 |
|
101 // Opt crash [@ js_NewFlatClosure] near null |
|
102 // ===== |
|
103 "" + function(){for(var [x] in x1) ([]); function x(){}} |
|
104 |
|
105 // Assertion failure: cg->stackDepth == stackDepth, at ../jsemit.cpp:3664 |
|
106 // Opt crash [@ JS_ArenaRealloc] near null |
|
107 // ===== |
|
108 try |
|
109 { |
|
110 eval( |
|
111 "for (a in (function(){" + |
|
112 " for each (let x in ['']) { return new function x1 (\u3056) { yield x } ();" + |
|
113 " }})())" + |
|
114 " function(){}" |
|
115 ); |
|
116 } |
|
117 catch(ex) |
|
118 { |
|
119 } |
|
120 // Crash [@ js_Interpret] near null |
|
121 // ===== |
|
122 |
|
123 reportCompare(expect, actual, summary); |
|
124 |
|
125 exitFunc ('test'); |
|
126 } |