yield-identifier-strict-strict.js (1089B)
1 // |reftest| error:SyntaxError 2 'use strict'; 3 // This file was procedurally generated from the following sources: 4 // - src/async-generators/yield-identifier-strict.case 5 // - src/async-generators/default/async-class-decl-method.template 6 /*--- 7 description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Async Generator method as a ClassDeclaration element) 8 esid: prod-AsyncGeneratorMethod 9 features: [async-iteration] 10 flags: [generated, onlyStrict] 11 negative: 12 phase: parse 13 type: SyntaxError 14 info: | 15 ClassElement : 16 MethodDefinition 17 18 MethodDefinition : 19 AsyncGeneratorMethod 20 21 Async Generator Function Definitions 22 23 AsyncGeneratorMethod : 24 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } 25 26 ---*/ 27 $DONOTEVALUATE(); 28 29 30 var callCount = 0; 31 32 class C { async *gen() { 33 callCount += 1; 34 (function() { 35 var yield; 36 throw new Test262Error(); 37 }()) 38 }} 39 40 var gen = C.prototype.gen; 41 42 var iter = gen(); 43 44 45 46 assert.sameValue(callCount, 1);