Closed Bug 469402 Opened 17 years ago Closed 9 years ago

Strange scoping with array comprehensions

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: testcase)

js> print(uneval([j for each (i in [[1],[2],[3,4]]) for each (j in i)])); [1, 2, 3, 4] js> print(uneval([7 for each (j in i) for each (i in [[31]])])); [] js> print(uneval([7 for each (j in i) for each (a in [31])])); typein:3: ReferenceError: i is not defined I think the second line should also throw "ReferenceError: i is not defined", since "i" is the loop variable for the inner loop and the outer loop tries to reference it. In other words, I expect nested array-comprehension loops to behave more like nested statement-level for-loops: js> for each (let j in i) for each (let i in [[31]]) { 7; } typein:1: ReferenceError: i is not defined
OS: Mac OS X → All
Hardware: x86 → All
Blocks: es6
Assignee: general → nobody
No longer blocks: es6
JS1.8 generator comprehensions were removed in bug 1220564, resolving as Won't Fix.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.