Index: src/harmony-typedarray.js |
diff --git a/src/harmony-typedarray.js b/src/harmony-typedarray.js |
index 0129f38d507cd0f8d0483a5ba3bbed8a04a2d773..014206c4cba8400cf745b9295d5cb223695ad6cb 100644 |
--- a/src/harmony-typedarray.js |
+++ b/src/harmony-typedarray.js |
@@ -58,6 +58,17 @@ function NAMEForEach(f /* thisArg */) { // length == 1 |
%_CallFunction(new_receiver, TO_OBJECT_INLINE(element), i, this, f); |
} |
} |
+ |
+// ES6 draft 08-24-14, section 22.2.2.2 |
+function NAMEOf() { // length == 0 |
+ var length = %_ArgumentsLength(); |
+ var array = new this(length); |
+ for (var i = 0; i < length; i++) { |
+ array[i] = %_Arguments(i); |
+ } |
+ return array; |
+} |
+ |
endmacro |
TYPED_ARRAYS(TYPED_ARRAY_HARMONY_ADDITIONS) |
@@ -67,6 +78,11 @@ function HarmonyTypedArrayExtendPrototypes() { |
macro EXTEND_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE) |
%CheckIsBootstrapping(); |
+ // Set up non-enumerable functions on the object. |
+ InstallFunctions(global.NAME, DONT_ENUM | DONT_DELETE | READ_ONLY, $Array( |
+ "of", NAMEOf |
+ )); |
+ |
// Set up non-enumerable functions on the prototype object. |
InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array( |
"forEach", NAMEForEach |