|
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 #82 From Gary Kwong [:nth10sd] |
|
24 |
|
25 // ===== |
|
26 |
|
27 (function(){function x(){} {let x = [] }}); |
|
28 |
|
29 // ===== |
|
30 |
|
31 var f = new Function("new function x(){ return x |= function(){} } ([], function(){})"); |
|
32 "" + f; |
|
33 |
|
34 // ===== |
|
35 |
|
36 uneval(function(){[y] = [x];}); |
|
37 |
|
38 // ===== |
|
39 |
|
40 function g(code) |
|
41 { |
|
42 var f = new Function(code); |
|
43 f(); |
|
44 } |
|
45 g("for (var x = 0; x < 3; ++x)(new (function(){})());"); |
|
46 |
|
47 // ===== |
|
48 |
|
49 try |
|
50 { |
|
51 (function(){new (function ({}, x) { yield (x(1e-81) for (x4 in undefined)) })()})(); |
|
52 } |
|
53 catch(ex) |
|
54 { |
|
55 } |
|
56 // ===== |
|
57 |
|
58 try |
|
59 { |
|
60 (function(){[(function ([y]) { })() for each (x in [])];})(); |
|
61 } |
|
62 catch(ex) |
|
63 { |
|
64 } |
|
65 // ===== |
|
66 |
|
67 try |
|
68 { |
|
69 eval('(function(){for(var x2 = [function(id) { return id } for each (x in []) if ([])] in functional) function(){};})();'); |
|
70 } |
|
71 catch(ex) |
|
72 { |
|
73 } |
|
74 |
|
75 // ===== |
|
76 |
|
77 if (typeof window == 'undefined') |
|
78 global = this; |
|
79 else |
|
80 global = window; |
|
81 |
|
82 try |
|
83 { |
|
84 eval('(function(){with(global){1e-81; }for(let [x, x3] = global -= x in []) function(){}})();'); |
|
85 } |
|
86 catch(ex) |
|
87 { |
|
88 } |
|
89 |
|
90 // ===== |
|
91 try |
|
92 { |
|
93 eval( |
|
94 'for(let [\n' + |
|
95 'function x () { M:if([1,,]) }\n' |
|
96 ); |
|
97 } |
|
98 catch(ex) |
|
99 { |
|
100 } |
|
101 |
|
102 // ===== |
|
103 |
|
104 try |
|
105 { |
|
106 function foo(code) |
|
107 { |
|
108 var c; |
|
109 eval("const c, x5 = c;"); |
|
110 } |
|
111 foo(); |
|
112 } |
|
113 catch(ex) |
|
114 { |
|
115 } |
|
116 |
|
117 // ===== |
|
118 |
|
119 var f = new Function("try { with({}) x = x; } catch(\u3056 if (function(){x = x2;})()) { let([] = [1.2e3.valueOf(\"number\")]) ((function(){})()); } "); |
|
120 "" + f; |
|
121 |
|
122 // ===== |
|
123 |
|
124 var f = new Function("[] = [( '' )()];"); |
|
125 "" + f; |
|
126 |
|
127 // ===== |
|
128 |
|
129 try |
|
130 { |
|
131 eval( |
|
132 'for(let x;' + |
|
133 ' ([,,,]' + |
|
134 ' .toExponential(new Function(), (function(){}))); [] = {})' + |
|
135 ' for(var [x, x] = * in this.__defineSetter__("", function(){}));' |
|
136 ); |
|
137 } |
|
138 catch(ex) |
|
139 { |
|
140 } |
|
141 |
|
142 // ===== |
|
143 |
|
144 reportCompare(expect, actual, summary); |
|
145 |
|
146 exitFunc ('test'); |
|
147 } |