Index: src/harmony-array.js |
diff --git a/src/harmony-array.js b/src/harmony-array.js |
index 00a1fa07eed3c69390bf6753bacf4b6dfbe897ea..550c340c6f8a041d1fb1f20220c610387fc15fda 100644 |
--- a/src/harmony-array.js |
+++ b/src/harmony-array.js |
@@ -2,12 +2,6 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-var $innerArrayCopyWithin; |
-var $innerArrayFill; |
-var $innerArrayFind; |
-var $innerArrayFindIndex; |
-var $arrayFrom; |
- |
(function(global, utils) { |
'use strict'; |
@@ -20,12 +14,18 @@ var $arrayFrom; |
var GlobalArray = global.Array; |
var GlobalSymbol = global.Symbol; |
+var GetIterator; |
+var GetMethod; |
var MathMax; |
var MathMin; |
+var ObjectIsFrozen; |
utils.Import(function(from) { |
+ GetIterator = from.GetIterator; |
+ GetMethod = from.GetMethod; |
MathMax = from.MathMax; |
MathMin = from.MathMin; |
+ ObjectIsFrozen = from.ObjectIsFrozen; |
}); |
// ------------------------------------------------------------------- |
@@ -179,7 +179,7 @@ function InnerArrayFill(value, start, end, array, length) { |
if (end > length) end = length; |
} |
- if ((end - i) > 0 && $objectIsFrozen(array)) { |
+ if ((end - i) > 0 && ObjectIsFrozen(array)) { |
throw MakeTypeError(kArrayFunctionsOnFrozen); |
} |
@@ -216,7 +216,7 @@ function ArrayFrom(arrayLike, mapfn, receiver) { |
} |
} |
- var iterable = $getMethod(items, symbolIterator); |
+ var iterable = GetMethod(items, symbolIterator); |
var k; |
var result; |
var mappedValue; |
@@ -225,7 +225,7 @@ function ArrayFrom(arrayLike, mapfn, receiver) { |
if (!IS_UNDEFINED(iterable)) { |
result = %IsConstructor(this) ? new this() : []; |
- var iterator = $getIterator(items, iterable); |
+ var iterator = GetIterator(items, iterable); |
k = 0; |
while (true) { |
@@ -266,7 +266,7 @@ function ArrayFrom(arrayLike, mapfn, receiver) { |
return result; |
} |
} |
-$arrayFrom = ArrayFrom; |
+ |
Jakob Kummerow
2015/05/21 13:45:24
nit: surrounding code seems to be happy with just
|
// ES6, draft 05-22-14, section 22.1.2.3 |
function ArrayOf() { |
@@ -283,7 +283,7 @@ function ArrayOf() { |
// ------------------------------------------------------------------- |
-$installConstants(GlobalSymbol, [ |
+utils.InstallConstants(GlobalSymbol, [ |
// TODO(dslomov, caitp): Move to symbol.js when shipping |
"isConcatSpreadable", symbolIsConcatSpreadable |
]); |
@@ -295,17 +295,28 @@ $installConstants(GlobalSymbol, [ |
%FunctionSetLength(ArrayFindIndex, 1); |
// Set up non-enumerable functions on the Array object. |
-$installFunctions(GlobalArray, DONT_ENUM, [ |
+utils.InstallFunctions(GlobalArray, DONT_ENUM, [ |
"from", ArrayFrom, |
"of", ArrayOf |
]); |
// Set up the non-enumerable functions on the Array prototype object. |
-$installFunctions(GlobalArray.prototype, DONT_ENUM, [ |
+utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [ |
"copyWithin", ArrayCopyWithin, |
"find", ArrayFind, |
"findIndex", ArrayFindIndex, |
"fill", ArrayFill |
]); |
+// ------------------------------------------------------------------- |
+// Exports |
+ |
+utils.Export(function(to) { |
+ to.ArrayFrom = ArrayFrom; |
+ to.InnerArrayCopyWithin = InnerArrayCopyWithin; |
+ to.InnerArrayFill = InnerArrayFill; |
+ to.InnerArrayFind = InnerArrayFind; |
+ to.InnerArrayFindIndex = InnerArrayFindIndex; |
+}); |
+ |
}) |