Index: src/js/array-iterator.js |
diff --git a/src/js/array-iterator.js b/src/js/array-iterator.js |
index 2ab6c8c1cb0b58a49e78857759b1409d2033a8c8..b3e25e9adbe77b5d350921aadfe26572ed09e0a1 100644 |
--- a/src/js/array-iterator.js |
+++ b/src/js/array-iterator.js |
@@ -109,6 +109,24 @@ function ArrayKeys() { |
return CreateArrayIterator(this, ITERATOR_KIND_KEYS); |
} |
+// TODO(littledan): Check for detached TypedArray in these three methods |
+function TypedArrayEntries() { |
+ if (!IS_TYPEDARRAY(this)) throw MakeTypeError(kNotTypedArray); |
+ return %_Call(ArrayEntries, this); |
+} |
+ |
+ |
+function TypedArrayValues() { |
+ if (!IS_TYPEDARRAY(this)) throw MakeTypeError(kNotTypedArray); |
+ return %_Call(ArrayValues, this); |
+} |
+ |
+ |
+function TypedArrayKeys() { |
+ if (!IS_TYPEDARRAY(this)) throw MakeTypeError(kNotTypedArray); |
+ return %_Call(ArrayKeys, this); |
+} |
+ |
%FunctionSetPrototype(ArrayIterator, {__proto__: IteratorPrototype}); |
%FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator'); |
@@ -133,12 +151,13 @@ utils.SetFunctionName(ArrayValues, 'values'); |
%AddNamedProperty(GlobalArray.prototype, iteratorSymbol, ArrayValues, |
DONT_ENUM); |
+utils.InstallFunctions(GlobalTypedArray.prototype, DONT_ENUM, [ |
+ 'entries', TypedArrayEntries, |
+ 'keys', TypedArrayKeys, |
+ 'values', TypedArrayValues |
+]); |
%AddNamedProperty(GlobalTypedArray.prototype, |
- 'entries', ArrayEntries, DONT_ENUM); |
-%AddNamedProperty(GlobalTypedArray.prototype, 'values', ArrayValues, DONT_ENUM); |
-%AddNamedProperty(GlobalTypedArray.prototype, 'keys', ArrayKeys, DONT_ENUM); |
-%AddNamedProperty(GlobalTypedArray.prototype, |
- iteratorSymbol, ArrayValues, DONT_ENUM); |
+ iteratorSymbol, TypedArrayValues, DONT_ENUM); |
// ------------------------------------------------------------------- |
// Exports |