| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 return iterator; | 39 return iterator; |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 // ES6 section 21.1.5.2.1 %StringIteratorPrototype%.next ( ) | 43 // ES6 section 21.1.5.2.1 %StringIteratorPrototype%.next ( ) |
| 44 function StringIteratorNext() { | 44 function StringIteratorNext() { |
| 45 var iterator = this; | 45 var iterator = this; |
| 46 var value = UNDEFINED; | 46 var value = UNDEFINED; |
| 47 var done = true; | 47 var done = true; |
| 48 | 48 |
| 49 if (!IS_SPEC_OBJECT(iterator) || | 49 if (!IS_RECEIVER(iterator) || |
| 50 !HAS_DEFINED_PRIVATE(iterator, stringIteratorNextIndexSymbol)) { | 50 !HAS_DEFINED_PRIVATE(iterator, stringIteratorNextIndexSymbol)) { |
| 51 throw MakeTypeError(kIncompatibleMethodReceiver, | 51 throw MakeTypeError(kIncompatibleMethodReceiver, |
| 52 'String Iterator.prototype.next'); | 52 'String Iterator.prototype.next'); |
| 53 } | 53 } |
| 54 | 54 |
| 55 var s = GET_PRIVATE(iterator, stringIteratorIteratedStringSymbol); | 55 var s = GET_PRIVATE(iterator, stringIteratorIteratedStringSymbol); |
| 56 if (!IS_UNDEFINED(s)) { | 56 if (!IS_UNDEFINED(s)) { |
| 57 var position = GET_PRIVATE(iterator, stringIteratorNextIndexSymbol); | 57 var position = GET_PRIVATE(iterator, stringIteratorNextIndexSymbol); |
| 58 var length = TO_UINT32(s.length); | 58 var length = TO_UINT32(s.length); |
| 59 if (position >= length) { | 59 if (position >= length) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 'next', StringIteratorNext | 93 'next', StringIteratorNext |
| 94 ]); | 94 ]); |
| 95 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol, | 95 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol, |
| 96 "String Iterator", READ_ONLY | DONT_ENUM); | 96 "String Iterator", READ_ONLY | DONT_ENUM); |
| 97 | 97 |
| 98 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol); | 98 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol); |
| 99 %AddNamedProperty(GlobalString.prototype, iteratorSymbol, | 99 %AddNamedProperty(GlobalString.prototype, iteratorSymbol, |
| 100 StringPrototypeIterator, DONT_ENUM); | 100 StringPrototypeIterator, DONT_ENUM); |
| 101 | 101 |
| 102 }) | 102 }) |
| OLD | NEW |