All users were logged out of Bugzilla on October 13th, 2018

ES6 Comprehension syntax is different

RESOLVED DUPLICATE of bug 979865

Status

()

RESOLVED DUPLICATE of bug 979865
5 years ago
5 years ago

People

(Reporter: bbenvie, Unassigned)

Tracking

(Blocks: 1 bug)

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
The syntax for Array Comprehensions in ES6 is different from what's implemented in SpiderMonkey. The AssignmentExpression now comes at the end of comprehension, instead of the beginning.

SpiderMonkey:
> [x for (x of iter) if (cond)]

ES6
> [for (x of iter) if (cond) x]


See ES6 draft spec section 11.1.4.2.

Reference: https://github.com/rwldrn/tc39-notes/blob/master/es6/2013-01/jan-31.md#comprehensionsgenerator-syntax
(Reporter)

Updated

5 years ago
Summary: ES6 Array Comprehension syntax is different → ES6 Array/Generator Comprehension syntax is different
(Reporter)

Updated

5 years ago
Summary: ES6 Array/Generator Comprehension syntax is different → ES6 Comprehension syntax is different
(Reporter)

Comment 1

5 years ago
This applies to both Generator and Array Comprehensions.
Ooh, can we get rid of that arrayComprehensionTail "I thought this parse tree was in this function, but really it's in this other function" craziness?
I was just reviewing the Set docs (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) and there was an example that used the obsolete syntax to illustrate an intersection operation with new Set(initializer). I've updated the example and added a note explaining SpiderMonkey syntax is incorrect. 

cc Andy Wingo

Comment 4

5 years ago
Is this a DUP of bug 979865 ?

Comment 5

5 years ago
(In reply to David Bruant from comment #4)
> Is this a DUP of bug 979865 ?

Indeed.  I did search for dups, but it seems my keyword-fu is weak :P
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 979865
You need to log in before you can comment on or make changes to this bug.