OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
6 // in runtime.js: | 6 // in runtime.js: |
7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
8 // var $Boolean = global.Boolean; | 8 // var $Boolean = global.Boolean; |
9 // var $Number = global.Number; | 9 // var $Number = global.Number; |
10 // var $Function = global.Function; | 10 // var $Function = global.Function; |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 SetUpFunction(); | 1876 SetUpFunction(); |
1877 | 1877 |
1878 | 1878 |
1879 // ---------------------------------------------------------------------------- | 1879 // ---------------------------------------------------------------------------- |
1880 // Iterator related spec functions. | 1880 // Iterator related spec functions. |
1881 | 1881 |
1882 // ES6 rev 33, 2015-02-12 | 1882 // ES6 rev 33, 2015-02-12 |
1883 // 7.4.1 GetIterator ( obj, method ) | 1883 // 7.4.1 GetIterator ( obj, method ) |
1884 function GetIterator(obj, method) { | 1884 function GetIterator(obj, method) { |
1885 if (IS_UNDEFINED(method)) { | 1885 if (IS_UNDEFINED(method)) { |
1886 method = ToObject(obj)[symbolIterator]; | 1886 method = obj[symbolIterator]; |
1887 } | 1887 } |
1888 if (!IS_SPEC_FUNCTION(method)) { | 1888 if (!IS_SPEC_FUNCTION(method)) { |
1889 throw MakeTypeError('not_iterable', [obj]); | 1889 throw MakeTypeError('not_iterable', [obj]); |
1890 } | 1890 } |
1891 var iterator = %_CallFunction(obj, method); | 1891 var iterator = %_CallFunction(obj, method); |
1892 if (!IS_SPEC_OBJECT(iterator)) { | 1892 if (!IS_SPEC_OBJECT(iterator)) { |
1893 throw MakeTypeError('not_an_iterator', [iterator]); | 1893 throw MakeTypeError('not_an_iterator', [iterator]); |
1894 } | 1894 } |
1895 return iterator; | 1895 return iterator; |
1896 } | 1896 } |
OLD | NEW |