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