blob: e70c9ae6797873f639b6e847e0600638b222f1f0 [file] [log] [blame]
"use strict";
function makeClosure(x)
{
return (f) => {
if (x == 42) {
x = 0;
return f(f);
}
else
return x;
}
}
for (var i = 0; i < 1000; ++i) {
var g = makeClosure(42);
var h = makeClosure(41);
var value = g(h);
if (value != 41)
throw "Wrong result, got: " + value;
}