js/src/tests/js1_8_1/regress/regress-452498-052.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_8_1/regress/regress-452498-052.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/*
     1.6 + * Any copyright is dedicated to the Public Domain.
     1.7 + * http://creativecommons.org/licenses/publicdomain/
     1.8 + * Contributor: Jason Orendorff
     1.9 + */
    1.10 +
    1.11 +//-----------------------------------------------------------------------------
    1.12 +var BUGNUMBER = 452498;
    1.13 +var summary = 'TM: upvar2 regression tests';
    1.14 +var actual = '';
    1.15 +var expect = '';
    1.16 +
    1.17 +
    1.18 +//-----------------------------------------------------------------------------
    1.19 +test();
    1.20 +//-----------------------------------------------------------------------------
    1.21 +
    1.22 +function test()
    1.23 +{
    1.24 +  enterFunc ('test');
    1.25 +  printBugNumber(BUGNUMBER);
    1.26 +  printStatus (summary);
    1.27 +
    1.28 +// ------- Comment #52 From Jason Orendorff
    1.29 +
    1.30 +// Crash in NoteLValue, called from BindDestructuringVar.
    1.31 +// NoteLValue assumes pn->pn_lexdef is non-null, but here
    1.32 +// pn is itself the definition of x.
    1.33 +  for (var [x]=0 in null) ;
    1.34 +
    1.35 +// This one only crashes when executed from a file.
    1.36 +// Assertion failure: pn != dn->dn_uses, at ../jsparse.cpp:1131
    1.37 +  for (var f in null)
    1.38 +    ;
    1.39 +  var f = 1;
    1.40 +  (f)
    1.41 +
    1.42 +// Assertion failure: pnu->pn_cookie == FREE_UPVAR_COOKIE, at ../jsemit.cpp:1815
    1.43 +// In EmitEnterBlock. x has one use, which is pnu here.
    1.44 +// pnu is indeed a name, but pnu->pn_cookie is 0.
    1.45 +    try { eval('let (x = 1) { var x; }'); } catch(ex) {}
    1.46 +
    1.47 +// Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:1992
    1.48 +// atom="x", upvars is empty.
    1.49 +  (1 for each (x in x));
    1.50 +
    1.51 +  reportCompare(expect, actual, summary);
    1.52 +
    1.53 +  exitFunc ('test');
    1.54 +}

mercurial