Closed Bug 386048 Opened 17 years ago Closed 15 years ago

Syntax error with destructuring assignments and array comprehensions/generator expressions

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: nanto, Unassigned)

Details

Attachments

(1 file)

js> for each (let [i] in [[1, 2], [3, 4]]) print(i); // ok
1
3
js> [i for each ([i] in [[1, 2], [3, 4]])] // expected: 1,3
typein:2: SyntaxError: invalid for/in left-hand side:
typein:2: [i for each ([i] in [[1, 2], [3, 4]])]
typein:2: ...............^
js> [i for each ([i, ,] in [[1, 2], [3, 4]])] // ok
1,3
js> [i for each ([, i] in [[1, 2], [3, 4]])] // ok
2,4
js> (i for each ([i] in [[1, 2], [3, 4]])) // expected: [object Generator]
typein:5: SyntaxError: invalid for/in left-hand side:
typein:5: (i for each ([i] in [[1, 2], [3, 4]]))
typein:5: ...............^

The same error occus even if you change "for each" to "for."
Use js1.8 in Firefox 3 alpha (Minefield) to enjoy the fix. Sorry for the js1.7 botch here.

/be
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Attached file testcase in browser
Though bug 366941 was marked as FIXED, this bug still occurs in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a6pre) Gecko/20070628 Minefield/3.0a6pre. And this bug occurs only in array comprehensions and generator expressions, not in for-in and for-each-in statements.
this bug reproduced in my environment.
* JS Shell current (js -v 180)
* Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a7pre) Gecko/2007070518 Minefield/3.0a7pre ID:2007070518

nanto_vi, can you reopen?
Still reproduces in Win/2007070604.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
This bug occurs in Firefox 3, but not in Firefox 3.5 and trunk.
Status: REOPENED → RESOLVED
Closed: 17 years ago15 years ago
Resolution: --- → FIXED
No bug or patch referenced as the fix.
Resolution: FIXED → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: