Syntax error with destructuring assignments and array comprehensions/generator expressions

RESOLVED WORKSFORME

Status

()

Core
JavaScript Engine
RESOLVED WORKSFORME
11 years ago
9 years ago

People

(Reporter: nanto_vi (TOYAMA Nao), Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

11 years ago
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
Last Resolved: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 366941
(Reporter)

Comment 2

11 years ago
Created attachment 270202 [details]
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?
(Reporter)

Comment 4

11 years ago
Still reproduces in Win/2007070604.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
(Reporter)

Comment 5

9 years ago
This bug occurs in Firefox 3, but not in Firefox 3.5 and trunk.
Status: REOPENED → RESOLVED
Last Resolved: 11 years ago9 years ago
Resolution: --- → FIXED

Comment 6

9 years ago
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.