Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
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 */
8 //-----------------------------------------------------------------------------
9 var BUGNUMBER = 452498;
10 var summary = 'TM: upvar2 regression tests';
11 var actual = '';
12 var expect = '';
15 //-----------------------------------------------------------------------------
16 test();
17 //-----------------------------------------------------------------------------
19 function test()
20 {
21 enterFunc ('test');
22 printBugNumber(BUGNUMBER);
23 printStatus (summary);
25 // ------- Comment #52 From Jason Orendorff
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) ;
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)
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) {}
44 // Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:1992
45 // atom="x", upvars is empty.
46 (1 for each (x in x));
48 reportCompare(expect, actual, summary);
50 exitFunc ('test');
51 }