Closed Bug 1278150 Opened 8 years ago Closed 8 years ago

Add support for |for (const of iterable)|

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1069480

People

(Reporter: ehsan.akhgari, Unassigned)

Details

(Whiteboard: [v8api])

The following code throws a SyntaxError in SpiderMonkey:

for (const x in [1, 2, 3]) x;

/*
Exception: SyntaxError: missing = in const declaration
@Scratchpad/1:1
*/

V8 seems to accept it.
SpiderNode issue for removing the workaround added there: <https://github.com/mozilla/spidernode/issues/151>
There's a cluster of bugs around for-in/of loop scoping that are responsible for this: bug 449811, bug 1069480, and at least one or two others I've forgotten.  Semi-arbitrarily choosing one of them to record as dup, and it might even be the right one.

I have partial patchwork implementing some of those changes, but the full fix runs into very fundamental issues in how SpiderMonkey tracks scope bindings, and in how SpiderMonkey determines what binding a particular assignment targets.  The full fix might end up waiting on a rewrite of our frontend, being done by shu (and others of us) in the https://github.com/syg/gecko-dev/tree/purgatio tag/branch.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.