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

Side by Side Diff: src/js/string-iterator.js

Issue 1783643002: String.prototype[Symbol.iterator] does RequireObjectCoercible(this) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove RegExp changes accidentally added Created 4 years, 9 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 | « no previous file | test/test262/test262.status » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 14 matching lines...) Expand all
25 MakeTypeError = from.MakeTypeError; 25 MakeTypeError = from.MakeTypeError;
26 }); 26 });
27 27
28 // ------------------------------------------------------------------- 28 // -------------------------------------------------------------------
29 29
30 function StringIterator() {} 30 function StringIterator() {}
31 31
32 32
33 // 21.1.5.1 CreateStringIterator Abstract Operation 33 // 21.1.5.1 CreateStringIterator Abstract Operation
34 function CreateStringIterator(string) { 34 function CreateStringIterator(string) {
35 CHECK_OBJECT_COERCIBLE(string, 'String.prototype[Symbol.iterator]');
35 var s = TO_STRING(string); 36 var s = TO_STRING(string);
36 var iterator = new StringIterator; 37 var iterator = new StringIterator;
37 SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s); 38 SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s);
38 SET_PRIVATE(iterator, stringIteratorNextIndexSymbol, 0); 39 SET_PRIVATE(iterator, stringIteratorNextIndexSymbol, 0);
39 return iterator; 40 return iterator;
40 } 41 }
41 42
42 43
43 // ES6 section 21.1.5.2.1 %StringIteratorPrototype%.next ( ) 44 // ES6 section 21.1.5.2.1 %StringIteratorPrototype%.next ( )
44 function StringIteratorNext() { 45 function StringIteratorNext() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 'next', StringIteratorNext 94 'next', StringIteratorNext
94 ]); 95 ]);
95 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol, 96 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol,
96 "String Iterator", READ_ONLY | DONT_ENUM); 97 "String Iterator", READ_ONLY | DONT_ENUM);
97 98
98 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol); 99 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol);
99 %AddNamedProperty(GlobalString.prototype, iteratorSymbol, 100 %AddNamedProperty(GlobalString.prototype, iteratorSymbol,
100 StringPrototypeIterator, DONT_ENUM); 101 StringPrototypeIterator, DONT_ENUM);
101 102
102 }) 103 })
OLDNEW
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698