michael@0: // The identifier of a ComprehensionFor is only bound within its tail. michael@0: michael@0: function t() { michael@0: var x = [0, 1, 2]; michael@0: return [for (x of x) x*2] michael@0: } michael@0: assertDeepEq(t(), [0, 2, 4]); michael@0: michael@0: // Each iteration should create a fresh binding. Unfortunately this is michael@0: // not currently the case, but bug 449811 will fix this. michael@0: function t2() { michael@0: var x = [0, 1, 2]; michael@0: return [for (x of x) ()=>x] michael@0: } michael@0: // FIXME: Should be [0, 1, 2]. michael@0: assertDeepEq([for (x of t2()) x()], [2, 2, 2]); michael@0: michael@0: reportCompare(null, null, "test");