OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // This file relies on the fact that the following declarations have been made | 7 // This file relies on the fact that the following declarations have been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Function = global.Function; | 9 // var $Function = global.Function; |
10 | 10 |
11 // ---------------------------------------------------------------------------- | 11 // ---------------------------------------------------------------------------- |
12 | 12 |
13 | 13 |
14 // Generator functions and objects are specified by ES6, sections 15.19.3 and | 14 // Generator functions and objects are specified by ES6, sections 15.19.3 and |
15 // 15.19.4. | 15 // 15.19.4. |
16 | 16 |
17 function GeneratorObjectNext(value) { | 17 function GeneratorObjectNext(value) { |
18 if (!IS_GENERATOR(this)) { | 18 if (!IS_GENERATOR(this)) { |
19 throw MakeTypeError('incompatible_method_receiver', | 19 throw MakeTypeError('incompatible_method_receiver', |
20 ['[Generator].prototype.next', this]); | 20 ['[Generator].prototype.next', this]); |
21 } | 21 } |
22 | 22 |
23 if (DEBUG_IS_ACTIVE) %DebugPrepareStepInIfStepping(this); | |
wingo
2014/09/17 11:30:03
Is this needed at almost every use of %_CallFuncti
| |
23 return %_GeneratorNext(this, value); | 24 return %_GeneratorNext(this, value); |
24 } | 25 } |
25 | 26 |
26 function GeneratorObjectThrow(exn) { | 27 function GeneratorObjectThrow(exn) { |
27 if (!IS_GENERATOR(this)) { | 28 if (!IS_GENERATOR(this)) { |
28 throw MakeTypeError('incompatible_method_receiver', | 29 throw MakeTypeError('incompatible_method_receiver', |
29 ['[Generator].prototype.throw', this]); | 30 ['[Generator].prototype.throw', this]); |
30 } | 31 } |
31 | 32 |
32 return %_GeneratorThrow(this, exn); | 33 return %_GeneratorThrow(this, exn); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY); | 78 GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY); |
78 %InternalSetPrototype(GeneratorFunctionPrototype, $Function.prototype); | 79 %InternalSetPrototype(GeneratorFunctionPrototype, $Function.prototype); |
79 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); | 80 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); |
80 %AddNamedProperty(GeneratorFunctionPrototype, "constructor", | 81 %AddNamedProperty(GeneratorFunctionPrototype, "constructor", |
81 GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY); | 82 GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY); |
82 %InternalSetPrototype(GeneratorFunction, $Function); | 83 %InternalSetPrototype(GeneratorFunction, $Function); |
83 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); | 84 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); |
84 } | 85 } |
85 | 86 |
86 SetUpGenerators(); | 87 SetUpGenerators(); |
OLD | NEW |