1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_8_5/regress/regress-569464.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +/* 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/licenses/publicdomain/ 1.7 + * Contributor: Dave Herman 1.8 + */ 1.9 + 1.10 +function earlyError(src) { 1.11 + var threw; 1.12 + try { 1.13 + eval(src); 1.14 + threw = false; 1.15 + } catch (expected) { 1.16 + threw = true; 1.17 + } 1.18 + assertEq(threw, true); 1.19 +} 1.20 + 1.21 +earlyError("'use strict'; let (x) 42;"); 1.22 +earlyError("function f() { 'use strict'; let (x) 42;"); 1.23 +earlyError("'use strict'; function id(x) { return x } let (a=1) a ? f : x++(42);"); 1.24 +earlyError("function id(x) { return x } function f() { 'use strict'; let (a=1) a ? f : x++(42); }"); 1.25 +earlyError("'use strict'; let (x=2, y=3) x=3, y=13"); 1.26 +earlyError("function f() { 'use strict'; let (x=2, y=3) x=3, y=13 }"); 1.27 + 1.28 +x = "global"; 1.29 +(let (x=2, y=3) x=3, y=13); 1.30 +assertEq(x, "global"); 1.31 +assertEq(y, 13); 1.32 + 1.33 +// https://bugzilla.mozilla.org/show_bug.cgi?id=569464#c12 1.34 +g = (let (x=7) x*x for each (x in [1,2,3])); 1.35 +for (let y in g) { 1.36 + assertEq(y, 49); 1.37 +} 1.38 + 1.39 +reportCompare(0, 0, "In strict mode, let expression statements are disallowed.");