Closed
Bug 925989
Opened 11 years ago
Closed 9 years ago
Replace E4X for-each with ES6 for-of in Add-on SDK and chrome JS
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: evilpie, Unassigned)
References
Details
Attachments
(1 file)
(deleted),
patch
|
Details | Diff | Splinter Review |
No description provided.
Reporter | ||
Comment 1•11 years ago
|
||
Reporter | ||
Comment 2•11 years ago
|
||
I have a few more patches, but they are really huge. Somebody wants to volunteer? They touch a lot of files in different components.
Comment 3•11 years ago
|
||
I can review some. Are all the transformations just turning this:
for each (let X in Y)
into this
for (let X of Y)
or are there other forms?
Reporter | ||
Comment 4•11 years ago
|
||
I think in practice this should work, but there might be some differences.
Reporter | ||
Comment 5•11 years ago
|
||
17:52 <evilpie> jorendorff: what are the differences beween for each and for of?
17:52 <evilpie> seems like only a custom iterator property?
17:52 <jorendorff> evilpie: for-each iterates over *properties*
17:54 <jorendorff> evilpie: for-of iterates over whatever obj.iterator() returns, so types like Map and Set, and generators, which don't treat their contents as properties, can still be iterable
17:54 <jorendorff> sorry
17:54 <jorendorff> obj[std_iterator]()
17:55 <jorendorff> (it should've been called .iterator() but TC39 <3 symbols)
17:56 <evilpie> oh because for each (x in {a: 1}) {} works
17:56 <sankha93> what is difference between the @@iterator and the symbol?
17:56 <evilpie> so we need to be careful to use Iterator() or something in that case
Comment 6•11 years ago
|
||
If for-each is used on an array then it can usually be changed to for-of easily. If for each is used on any other type of object, then the transformation looks like, from:
> for each (let value in obj) {
to:
> for (let key in obj) {
> let value = obj[key];
Comment 7•11 years ago
|
||
I've put the existing bugs that are "remove for each from ..." as blockers for this. Feel free to do this all as part of one big patch or however you want to do it, just wanted to make sure they get closed if they're fixed when this is fixed.
Reporter | ||
Comment 8•11 years ago
|
||
Verifying every single use and making sure that it is actually possible to convert to for .. of in a straightforward way almost seems like an impossible task.
Reporter | ||
Updated•11 years ago
|
Assignee: evilpies → nobody
Status: ASSIGNED → NEW
Reporter | ||
Updated•11 years ago
|
Attachment #816253 -
Flags: review?(Ms2ger)
Updated•10 years ago
|
Depends on: 1083467
OS: Linux → All
Hardware: x86_64 → All
Summary: Replace for each with for of in Mozilla code → Replace E4X for-each with ES6 for-of in Add-on SDK and chrome JS
Comment 10•9 years ago
|
||
All blocking bugs are fixed and other use are also removed in other bugs that blocks bug 1083470.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•