michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: * Contributor: Jason Orendorff michael@0: */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 452498; michael@0: var summary = 'TM: upvar2 regression tests'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: test(); michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: function test() michael@0: { michael@0: enterFunc ('test'); michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: // ------- Comment #52 From Jason Orendorff michael@0: michael@0: // Crash in NoteLValue, called from BindDestructuringVar. michael@0: // NoteLValue assumes pn->pn_lexdef is non-null, but here michael@0: // pn is itself the definition of x. michael@0: for (var [x]=0 in null) ; michael@0: michael@0: // This one only crashes when executed from a file. michael@0: // Assertion failure: pn != dn->dn_uses, at ../jsparse.cpp:1131 michael@0: for (var f in null) michael@0: ; michael@0: var f = 1; michael@0: (f) michael@0: michael@0: // Assertion failure: pnu->pn_cookie == FREE_UPVAR_COOKIE, at ../jsemit.cpp:1815 michael@0: // In EmitEnterBlock. x has one use, which is pnu here. michael@0: // pnu is indeed a name, but pnu->pn_cookie is 0. michael@0: try { eval('let (x = 1) { var x; }'); } catch(ex) {} michael@0: michael@0: // Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:1992 michael@0: // atom="x", upvars is empty. michael@0: (1 for each (x in x)); michael@0: michael@0: reportCompare(expect, actual, summary); michael@0: michael@0: exitFunc ('test'); michael@0: }