Index: src/harmony-array.js |
diff --git a/src/harmony-array.js b/src/harmony-array.js |
index dbcb292a0876842e8d3a6d4c0d21d997cdf6d977..9893e8728ae32c883a33a56c594bc9768ca97464 100644 |
--- a/src/harmony-array.js |
+++ b/src/harmony-array.js |
@@ -123,11 +123,32 @@ function ArrayFill(value /* [, start [, end ] ] */) { // length == 1 |
return array; |
} |
+// ES6, draft 05-22-14, section 22.1.2.3 |
+function ArrayOf() { |
+ var len = %_ArgumentsLength(); |
+ var C = this; |
+ if (%IsConstructor(C)) { |
+ var A = new C(len); |
+ } else { |
+ var A = []; |
+ } |
+ for (var k = 0; k < len; k++) { |
+ %AddProperty(A, k, %_Arguments(k), DONT_ENUM); |
caitp (gmail)
2014/07/07 16:52:09
Should this not be enumerable? I don't see anythin
|
+ } |
+ A.length = len; |
+ return A; |
+} |
+ |
// ------------------------------------------------------------------- |
function HarmonyArrayExtendArrayPrototype() { |
%CheckIsBootstrapping(); |
+ // Set up non-enumerable functions on the Array object. |
+ InstallFunctions($Array, DONT_ENUM, $Array( |
+ "of", ArrayOf |
+ )); |
+ |
// Set up the non-enumerable functions on the Array prototype object. |
InstallFunctions($Array.prototype, DONT_ENUM, $Array( |
"find", ArrayFind, |