gen-yield-identifier-strict-strict.js (910B)
1 // |reftest| error:SyntaxError 2 'use strict'; 3 // This file was procedurally generated from the following sources: 4 // - src/generators/yield-identifier-strict.case 5 // - src/generators/default/obj-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. (Generator method) 8 esid: prod-GeneratorMethod 9 features: [generators] 10 flags: [generated, onlyStrict] 11 negative: 12 phase: parse 13 type: SyntaxError 14 info: | 15 14.4 Generator Function Definitions 16 17 GeneratorMethod[Yield, Await]: 18 * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } 19 20 ---*/ 21 $DONOTEVALUATE(); 22 23 var callCount = 0; 24 25 var gen = { 26 *method() { 27 callCount += 1; 28 (function() { 29 var yield; 30 throw new Test262Error(); 31 }()) 32 } 33 }.method; 34 35 var iter = gen(); 36 37 38 39 assert.sameValue(callCount, 1);