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

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

Issue 1325023003: [es6] Fix invalid ToObject in String/Array iterator next. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
« src/array-iterator.js ('K') | « src/array-iterator.js ('k') | no next file » | 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 23 matching lines...) Expand all
34 var s = TO_STRING_INLINE(string); 34 var s = TO_STRING_INLINE(string);
35 var iterator = new StringIterator; 35 var iterator = new StringIterator;
36 SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s); 36 SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s);
37 SET_PRIVATE(iterator, stringIteratorNextIndexSymbol, 0); 37 SET_PRIVATE(iterator, stringIteratorNextIndexSymbol, 0);
38 return iterator; 38 return iterator;
39 } 39 }
40 40
41 41
42 // 21.1.5.2.1 %StringIteratorPrototype%.next( ) 42 // 21.1.5.2.1 %StringIteratorPrototype%.next( )
43 function StringIteratorNext() { 43 function StringIteratorNext() {
44 var iterator = TO_OBJECT(this); 44 var iterator = this;
45 45
46 if (!HAS_DEFINED_PRIVATE(iterator, stringIteratorNextIndexSymbol)) { 46 if (!IS_SPEC_OBJECT(iterator) ||
47 !HAS_DEFINED_PRIVATE(iterator, stringIteratorNextIndexSymbol)) {
47 throw MakeTypeError(kIncompatibleMethodReceiver, 48 throw MakeTypeError(kIncompatibleMethodReceiver,
48 'String Iterator.prototype.next'); 49 'String Iterator.prototype.next');
49 } 50 }
50 51
51 var s = GET_PRIVATE(iterator, stringIteratorIteratedStringSymbol); 52 var s = GET_PRIVATE(iterator, stringIteratorIteratedStringSymbol);
52 if (IS_UNDEFINED(s)) { 53 if (IS_UNDEFINED(s)) {
53 return ArrayIteratorCreateResultObject(UNDEFINED, true); 54 return ArrayIteratorCreateResultObject(UNDEFINED, true);
54 } 55 }
55 56
56 var position = GET_PRIVATE(iterator, stringIteratorNextIndexSymbol); 57 var position = GET_PRIVATE(iterator, stringIteratorNextIndexSymbol);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 'next', StringIteratorNext 95 'next', StringIteratorNext
95 ]); 96 ]);
96 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol, 97 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol,
97 "String Iterator", READ_ONLY | DONT_ENUM); 98 "String Iterator", READ_ONLY | DONT_ENUM);
98 99
99 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol); 100 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol);
100 %AddNamedProperty(GlobalString.prototype, iteratorSymbol, 101 %AddNamedProperty(GlobalString.prototype, iteratorSymbol,
101 StringPrototypeIterator, DONT_ENUM); 102 StringPrototypeIterator, DONT_ENUM);
102 103
103 }) 104 })
OLDNEW
« src/array-iterator.js ('K') | « src/array-iterator.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698