Index: src/array.js |
diff --git a/src/array.js b/src/array.js |
index 6cf417874da2924caf1477be658cefb408bfc3bc..0af101dedfe3864d32da1e1a5efc9695f49cde50 100644 |
--- a/src/array.js |
+++ b/src/array.js |
@@ -1004,7 +1004,7 @@ function ArrayFilter(f, receiver) { |
for (var i = 0; i < length; i++) { |
var current = this[i]; |
if (!IS_UNDEFINED(current) || i in this) { |
- if (f.call(receiver, current, i, this)) { |
+ if (%_CallFunction(receiver, current, i, this, f)) { |
Lasse Reichstein
2011/06/08 18:41:42
Does this correctly pass the global receiver to th
|
result[result_length++] = current; |
} |
} |
@@ -1028,7 +1028,7 @@ function ArrayForEach(f, receiver) { |
for (var i = 0; i < length; i++) { |
var current = this[i]; |
if (!IS_UNDEFINED(current) || i in this) { |
- f.call(receiver, current, i, this); |
+ %_CallFunction(receiver, current, i, this, f); |
} |
} |
} |
@@ -1051,7 +1051,7 @@ function ArraySome(f, receiver) { |
for (var i = 0; i < length; i++) { |
var current = this[i]; |
if (!IS_UNDEFINED(current) || i in this) { |
- if (f.call(receiver, current, i, this)) return true; |
+ if (%_CallFunction(receiver, current, i, this, f)) return true; |
} |
} |
return false; |
@@ -1073,7 +1073,7 @@ function ArrayEvery(f, receiver) { |
for (var i = 0; i < length; i++) { |
var current = this[i]; |
if (!IS_UNDEFINED(current) || i in this) { |
- if (!f.call(receiver, current, i, this)) return false; |
+ if (!%_CallFunction(receiver, current, i, this, f)) return false; |
} |
} |
return true; |
@@ -1096,7 +1096,7 @@ function ArrayMap(f, receiver) { |
for (var i = 0; i < length; i++) { |
var current = this[i]; |
if (!IS_UNDEFINED(current) || i in this) { |
- accumulator[i] = f.call(receiver, current, i, this); |
+ accumulator[i] = %_CallFunction(receiver, current, i, this, f); |
} |
} |
%MoveArrayContents(accumulator, result); |
@@ -1252,7 +1252,7 @@ function ArrayReduce(callback, current) { |
for (; i < length; i++) { |
var element = this[i]; |
if (!IS_UNDEFINED(element) || i in this) { |
- current = callback.call(null, current, element, i, this); |
+ current = %_CallFunction(void 0, current, element, i, this, callback); |
} |
} |
return current; |
@@ -1283,7 +1283,7 @@ function ArrayReduceRight(callback, current) { |
for (; i >= 0; i--) { |
var element = this[i]; |
if (!IS_UNDEFINED(element) || i in this) { |
- current = callback.call(null, current, element, i, this); |
+ current = %_CallFunction(void 0, current, element, i, this, callback); |
} |
} |
return current; |