Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: src/v8natives.js

Issue 936793003: Align GetIterator with ES6 spec (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/collection.js ('k') | src/weak-collection.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 "toString", FunctionToString 1872 "toString", FunctionToString
1873 )); 1873 ));
1874 } 1874 }
1875 1875
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 26, 2014-07-18 1882 // ES6 rev 33, 2015-02-12
1883 // 7.4.1 CheckIterable ( obj ) 1883 // 7.4.1 GetIterator ( obj, method )
1884 function ToIterable(obj) {
1885 if (!IS_SPEC_OBJECT(obj)) {
1886 return UNDEFINED;
1887 }
1888 return obj[symbolIterator];
1889 }
1890
1891
1892 // ES6 rev 26, 2014-07-18
1893 // 7.4.2 GetIterator ( obj, method )
1894 function GetIterator(obj, method) { 1884 function GetIterator(obj, method) {
1895 if (IS_UNDEFINED(method)) { 1885 if (IS_UNDEFINED(method)) {
1896 method = ToIterable(obj); 1886 method = ToObject(obj)[symbolIterator];
1897 } 1887 }
1898 if (!IS_SPEC_FUNCTION(method)) { 1888 if (!IS_SPEC_FUNCTION(method)) {
1899 throw MakeTypeError('not_iterable', [obj]); 1889 throw MakeTypeError('not_iterable', [obj]);
1900 } 1890 }
1901 var iterator = %_CallFunction(obj, method); 1891 var iterator = %_CallFunction(obj, method);
1902 if (!IS_SPEC_OBJECT(iterator)) { 1892 if (!IS_SPEC_OBJECT(iterator)) {
1903 throw MakeTypeError('not_an_iterator', [iterator]); 1893 throw MakeTypeError('not_an_iterator', [iterator]);
1904 } 1894 }
1905 return iterator; 1895 return iterator;
1906 } 1896 }
OLDNEW
« no previous file with comments | « src/collection.js ('k') | src/weak-collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698