Chromium Code Reviews| Index: src/js/array-iterator.js |
| diff --git a/src/js/array-iterator.js b/src/js/array-iterator.js |
| index 2ab6c8c1cb0b58a49e78857759b1409d2033a8c8..2a84f9d061b6895d3929dd71167127b4c6e2666d 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): ValidateTypedArray before each of these three |
|
adamk
2016/03/10 23:10:42
Is this about detachment? Can you make this more e
Dan Ehrenberg
2016/03/10 23:16:35
Done
|
| +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 |