| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/generators/yield-identifier-strict.case |
| 3 |
// - src/generators/default/class-expr-method.template |
| 4 |
/*--- |
| 5 |
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator method as a ClassExpression element) |
| 6 |
esid: prod-GeneratorMethod |
| 7 |
features: [generators] |
| 8 |
flags: [generated, onlyStrict] |
| 9 |
negative: |
| 10 |
phase: parse |
| 11 |
type: SyntaxError |
| 12 |
info: | |
| 13 |
ClassElement : |
| 14 |
MethodDefinition |
| 15 |
|
| 16 |
MethodDefinition : |
| 17 |
GeneratorMethod |
| 18 |
|
| 19 |
14.4 Generator Function Definitions |
| 20 |
|
| 21 |
GeneratorMethod : |
| 22 |
* PropertyName ( UniqueFormalParameters ) { GeneratorBody } |
| 23 |
|
| 24 |
---*/ |
| 25 |
throw "Test262: This statement should not be evaluated."; |
| 26 |
|
| 27 |
var callCount = 0; |
| 28 |
|
| 29 |
var C = class {*gen() { |
| 30 |
callCount += 1; |
| 31 |
(function() { |
| 32 |
var yield; |
| 33 |
throw new Test262Error(); |
| 34 |
}()) |
| 35 |
}} |
| 36 |
|
| 37 |
var gen = C.prototype.gen; |
| 38 |
|
| 39 |
var iter = gen(); |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
assert.sameValue(callCount, 1); |