js/src/tests/js1_8_5/regress/regress-554955-3.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:ef02e079d91b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * Any copyright is dedicated to the Public Domain.
4 * http://creativecommons.org/licenses/publicdomain/
5 */
6
7 function f(s) {
8 eval(s);
9 return function(a) {
10 with({}) {}; // repel JägerMonkey
11 eval(a);
12 let (c = 3) {
13 return b;
14 };
15 };
16 }
17
18 var b = 1;
19 var g1 = f("");
20 var g2 = f("var b = 2;");
21
22 /* Call the lambda once, caching a reference to the global b. */
23 g1('');
24
25 /*
26 * If this call sees the above cache entry, then it will erroneously use the
27 * global b.
28 */
29 assertEq(g2(''), 2);
30
31 reportCompare(true, true);

mercurial