Index: src/array.js |
diff --git a/src/array.js b/src/array.js |
index 9b0bfe19e6a25f25936901c5d206dffe54cad007..7e772ba6f8e203ce89555defdbaec4666f47c4d8 100644 |
--- a/src/array.js |
+++ b/src/array.js |
@@ -1549,10 +1549,22 @@ function SetUpArray() { |
%FinishArrayPrototypeSetup($Array.prototype); |
+ // Make InternalArray.prototype.concat return an InternalArray |
+ // instead of an Array. |
+ var getInternalArrayConcat = function(concatFn) { |
Michael Starzinger
2013/03/12 12:09:06
Drop this wrapper generator for a wrapper function
adamk
2013/03/12 18:25:19
Done.
|
+ return function() { |
+ var result = %Apply(concatFn, this, arguments, 0, %_ArgumentsLength()); |
+ var internalResult = new InternalArray(); |
+ %MoveArrayContents(result, internalResult); |
+ return internalResult; |
+ }; |
+ }; |
+ |
// The internal Array prototype doesn't need to be fancy, since it's never |
// exposed to user code. |
// Adding only the functions that are actually used. |
SetUpLockedPrototype(InternalArray, $Array(), $Array( |
+ "concat", getInternalArrayConcat(getFunction("concat", ArrayConcat)), |
Michael Starzinger
2013/03/12 12:09:06
Just install the plain unwrapped ArrayConcat funct
adamk
2013/03/12 18:25:19
Done.
|
"indexOf", getFunction("indexOf", ArrayIndexOf), |
"join", getFunction("join", ArrayJoin), |
"pop", getFunction("pop", ArrayPop), |