yield-identifier-strict-strict.js (874B)
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/expression.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. (Unnamed generator expression) 8 esid: prod-GeneratorExpression 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 GeneratorExpression: 18 function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } 19 20 ---*/ 21 $DONOTEVALUATE(); 22 23 var callCount = 0; 24 25 var gen = function *() { 26 callCount += 1; 27 (function() { 28 var yield; 29 throw new Test262Error(); 30 }()) 31 }; 32 33 var iter = gen(); 34 35 36 37 assert.sameValue(callCount, 1);