Closed
Bug 345736
Opened 19 years ago
Closed 19 years ago
"for each" and "let[x,y]" in array comprehensions
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
People
(Reporter: bugzilla, Assigned: brendan)
References
Details
(Keywords: verified1.8.1)
Attachments
(2 files)
|
5.33 KB,
patch
|
mrbkap
:
review+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
|
4.83 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b1) Gecko/20060724 BonEcho/2.0b1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b1) Gecko/20060724 BonEcho/2.0b1
Suppose you execute the following in Firefox 2.0:
arr=[x+x for (x in ["a","b","c"])];
Now arr contains ["00","11","22"]
Wanting to get a result like ["aa","bb","cc"], I try both of the following:
arr=[x+x for each (x in ["a","b","c"])];
arr=[x+x for (let [,x] in ["a","b","c"])];
But neither syntax is valid in array comprehensions, even though both are supported in for() loops. Supporting either of those would make JS 1.7's array comprehension support more python-like.
Reproducible: Always
Updated•19 years ago
|
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
| Assignee | ||
Comment 1•19 years ago
|
||
The destructuring assignment in comprehensions work is being tracked in bug 336379, but I'll take this one and make it depend on the js1.7 metabug.
/be
| Assignee | ||
Comment 2•19 years ago
|
||
Small patch (diff -w coming), needed for js1.7.
/be
Status: NEW → ASSIGNED
Flags: blocking1.8.1?
| Assignee | ||
Comment 3•19 years ago
|
||
diff -w version next.
/be
Attachment #232025 -
Flags: review?(mrbkap)
| Assignee | ||
Comment 4•19 years ago
|
||
Updated•19 years ago
|
Attachment #232025 -
Flags: review?(mrbkap) → review+
| Assignee | ||
Updated•19 years ago
|
Attachment #232025 -
Flags: approval1.8.1?
| Assignee | ||
Comment 5•19 years ago
|
||
Fixed on trunk.
/be
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 6•19 years ago
|
||
Comment on attachment 232025 [details] [diff] [review]
fix
a=schrep for drivers.
Attachment #232025 -
Flags: approval1.8.1? → approval1.8.1+
Comment 8•19 years ago
|
||
Checking in regress-345736.js;
/cvsroot/mozilla/js/tests/js1_7/geniter/regress-345736.js,v <-- regress-345736.js
initial revision: 1.1
tests for
[x+x for (x in ["a","b","c"])];
[x+x for each (x in ["a","b","c"])];
Flags: in-testsuite+
Comment 9•19 years ago
|
||
verified fixed 1.8, 1.9 win/mac(ppc|tel)/linux 20060808
Status: RESOLVED → VERIFIED
Keywords: fixed1.8.1 → verified1.8.1
| Assignee | ||
Updated•19 years ago
|
Flags: blocking1.8.1?
Comment 10•18 years ago
|
||
There should be regression tests for the destructuring-like form, too.
js> arr=[x+x for ([,x] in ["a","b","c"])];
aa,bb,cc
js> arr=[x+y for ([x,y] in ["a","b","c"])];
0a,1b,2c
Flags: in-testsuite+ → in-testsuite?
Comment 11•18 years ago
|
||
/cvsroot/mozilla/js/tests/js1_7/geniter/regress-345736.js,v <-- regress-345736.js
new revision: 1.2; previous revision: 1.1
done
Flags: in-testsuite? → in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•