|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* |
|
3 * Any copyright is dedicated to the Public Domain. |
|
4 * http://creativecommons.org/licenses/publicdomain/ |
|
5 * Contributor: Jason Orendorff |
|
6 */ |
|
7 |
|
8 //----------------------------------------------------------------------------- |
|
9 var BUGNUMBER = 452498; |
|
10 var summary = 'TM: upvar2 regression tests'; |
|
11 var actual = ''; |
|
12 var expect = ''; |
|
13 |
|
14 |
|
15 //----------------------------------------------------------------------------- |
|
16 test(); |
|
17 //----------------------------------------------------------------------------- |
|
18 |
|
19 function test() |
|
20 { |
|
21 enterFunc ('test'); |
|
22 printBugNumber(BUGNUMBER); |
|
23 printStatus (summary); |
|
24 |
|
25 // ------- Comment #52 From Jason Orendorff |
|
26 |
|
27 // Crash in NoteLValue, called from BindDestructuringVar. |
|
28 // NoteLValue assumes pn->pn_lexdef is non-null, but here |
|
29 // pn is itself the definition of x. |
|
30 for (var [x]=0 in null) ; |
|
31 |
|
32 // This one only crashes when executed from a file. |
|
33 // Assertion failure: pn != dn->dn_uses, at ../jsparse.cpp:1131 |
|
34 for (var f in null) |
|
35 ; |
|
36 var f = 1; |
|
37 (f) |
|
38 |
|
39 // Assertion failure: pnu->pn_cookie == FREE_UPVAR_COOKIE, at ../jsemit.cpp:1815 |
|
40 // In EmitEnterBlock. x has one use, which is pnu here. |
|
41 // pnu is indeed a name, but pnu->pn_cookie is 0. |
|
42 try { eval('let (x = 1) { var x; }'); } catch(ex) {} |
|
43 |
|
44 // Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:1992 |
|
45 // atom="x", upvars is empty. |
|
46 (1 for each (x in x)); |
|
47 |
|
48 reportCompare(expect, actual, summary); |
|
49 |
|
50 exitFunc ('test'); |
|
51 } |