michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: function f(s) { michael@0: eval(s); michael@0: return function(a) { michael@0: with({}) {}; // repel JägerMonkey michael@0: eval(a); michael@0: let (c = 3) { michael@0: return b; michael@0: }; michael@0: }; michael@0: } michael@0: michael@0: var b = 1; michael@0: var g1 = f(""); michael@0: var g2 = f("var b = 2;"); michael@0: michael@0: /* Call the lambda once, caching a reference to the global b. */ michael@0: g1(''); michael@0: michael@0: /* michael@0: * If this call sees the above cache entry, then it will erroneously use the michael@0: * global b. michael@0: */ michael@0: assertEq(g2(''), 2); michael@0: michael@0: reportCompare(true, true);