Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(767)

Unified Diff: src/harmony-array.js

Issue 1165003005: [es6] Array.prototype.find and findIndex should include holes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/harmony/array-find.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-array.js
diff --git a/src/harmony-array.js b/src/harmony-array.js
index 5df1abde0ff05d60afdb8d54abfc66572333c570..51e2d01b50147ded30436174685b23aca3484ac9 100644
--- a/src/harmony-array.js
+++ b/src/harmony-array.js
@@ -100,12 +100,10 @@ function InnerArrayFind(predicate, thisArg, array, length) {
}
for (var i = 0; i < length; i++) {
- if (i in array) {
- var element = array[i];
- var newThisArg = needs_wrapper ? $toObject(thisArg) : thisArg;
- if (%_CallFunction(newThisArg, element, i, array, predicate)) {
- return element;
- }
+ var element = array[i];
+ var newThisArg = needs_wrapper ? $toObject(thisArg) : thisArg;
+ if (%_CallFunction(newThisArg, element, i, array, predicate)) {
+ return element;
}
}
@@ -135,12 +133,10 @@ function InnerArrayFindIndex(predicate, thisArg, array, length) {
}
for (var i = 0; i < length; i++) {
- if (i in array) {
- var element = array[i];
- var newThisArg = needs_wrapper ? $toObject(thisArg) : thisArg;
- if (%_CallFunction(newThisArg, element, i, array, predicate)) {
- return i;
- }
+ var element = array[i];
+ var newThisArg = needs_wrapper ? $toObject(thisArg) : thisArg;
+ if (%_CallFunction(newThisArg, element, i, array, predicate)) {
+ return i;
}
}
« no previous file with comments | « no previous file | test/mjsunit/harmony/array-find.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698