|
|
|
6. Suspend methodContext . 7. Set generator .[[GeneratorState]] to executing . 8. Push genContext onto the ; genContext 9. Resume the suspended evaluation of genContext value ) as the result of the operation that suspended it. Let result be the value returned by the resumed computation. 10. : When we return here, genContext has already been removed from the and methodContext is the currently . 11. Return ( result ). The abstract operation GeneratorResumeAbrupt takes arguments generator , abruptCompletion whose [[Type]] is return or throw ), and generatorBrand . It performs the following steps when called: 1. Let state ( generator , generatorBrand ). 2. If state is suspendedStart , then a. Set generator .[[GeneratorState]] to completed . b. Once a generator enters the completed state it never leaves it and its associated is never resumed. Any execution state associated with generator can be discarded at this point. c. Set state to completed . 3. If state is completed , then a. If abruptCompletion .[[Type]] is return , then i. Return abruptCompletion .[[Value]], true ). b. Return ( abruptCompletion ). 4. : state is suspendedYield . 5. Let genContext be generator .[[GeneratorContext]]. 6. Let methodContext be the . 7. Suspend methodContext . 8. Set generator .[[GeneratorState]] to executing . 9. Push genContext onto the ; genContext 10. Resume the suspended evaluation of genContext using abruptCompletion as the result of the operation that suspended it. Let result be the completion record returned by the resumed computation. 11. : When we return here, genContext has already been removed from the and methodContext is the currently . 12. Return ( result ). The abstract operation GetGeneratorKind takes no arguments. It performs the following steps when called: 1. Let genContext 2. If genContext does not have a Generator component, return non-generator . 3. Let generator be the Generator component of genContext . 4. If generator has an [[AsyncGeneratorState]] internal slot, return async . 5. Else, return sync . 27.5.3.4 GeneratorResumeAbrupt ( generator , abruptCompletion , generatorBrand ) 27.5.3.5 GetGeneratorKind ( ) 27.5.3.6 GeneratorYield ( iterNextObj ) 784 |