Closed
Bug 1221634
Opened 9 years ago
Closed 9 years ago
Remove use of for-each from calendar/.
Categories
(Calendar :: General, defect)
Calendar
General
Tracking
(Not tracked)
RESOLVED
FIXED
4.8
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(2 files, 2 obsolete files)
39.07 KB,
text/plain
|
Details | |
260.33 KB,
patch
|
Fallen
:
review+
|
Details | Diff | Splinter Review |
Need to replace non-standard for-each with one of:
* for-of
* for-in
* array.map/array.filter for array-comprehension
as a part of bug 1083470.
converting rules are following:
* for-each
* for each (let x in array) { ... }
-> for (let x of array) { ... }
* for each (let x in object) { ... }
-> for (let key in object) { let x = object[key]; ... }
* for each (let [key, value] in Iterator(object)) { ... }
-> for (let key in object) { let value = object[key]; ... }
* for each (let x in array) { ... }
where array can be null or undefined
-> if (array) { for (let x of array) { ... } }
* legacy array comprehension with for-each
(newer array comprehension is now also a non-standard feature, I'd like to go with map/filter)
* [EXPR for each (x in array)]
-> array.map(x => EXPR)
* [EXPR for each (x in array) if (COND)]
-> array.filter(x => COND).map(x => EXPR)
* [x for each (x in array) if (COND)]
-> array.filter(x => COND)
* [EXPR for each ([i, x] in Iterator(array)) if (g(x, i)]
-> array.filter((x, i) => g(x, i)).map((x => EXPR)
* [EXPR for each (x in arraylike)]
-> Array.from(arraylike).map(x => EXPR)
* [EXPR for each (x in string)]
-> Array.prototype.slice.call(string).map(x => EXPR)
// Array.from behaves differently for surrogate-pair
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8687498 -
Flags: review?(matthew.mecca)
Assignee | ||
Comment 2•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8687498 -
Flags: review?(matthew.mecca) → review?(philipp)
Comment 3•9 years ago
|
||
This is my unrotten version of Tooru Fujisawas patch because original patch no longer applies.
Comment 4•9 years ago
|
||
Comment on attachment 8687498 [details] [diff] [review]
Remove for-each from calendar/.
As it is a lot of files I'm just reviewing the rules you mentioned and they look ok.
The only files that are problematic are the provider/gdata files. In an effort to support Postbox, I am currently maintaining compatibility to older Gecko versions. If support for |for each| goes away in m-c I'll probably have to break that, but I'd appreciate if we could keep |for of| out of that directory for now. Do you think you could handle that directory manually or revert the changes there?
Attachment #8687498 -
Flags: review?(philipp) → feedback+
Assignee | ||
Comment 5•9 years ago
|
||
As mentioned in IRC, removed the changes under providers/gdata for now.
Attachment #8687498 -
Attachment is obsolete: true
Attachment #8697849 -
Attachment is obsolete: true
Attachment #8698537 -
Flags: review?(philipp)
Comment 6•9 years ago
|
||
Comment on attachment 8698537 [details] [diff] [review]
Remove for-each from calendar/.
Review of attachment 8698537 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks!
Attachment #8698537 -
Flags: review?(philipp) → review+
Assignee | ||
Comment 7•9 years ago
|
||
https://hg.mozilla.org/comm-central/rev/ef3eebaf957dd3d48b9da69c75d288eb6882b6bf
Bug 1221634 - Remove for-each from calendar/. r=Fallen
Updated•9 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Updated•9 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Updated•9 years ago
|
Target Milestone: --- → 4.8
You need to log in
before you can comment on or make changes to this bug.
Description
•