Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/gen-method-yield-identifier-spread-strict.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/generators/yield-identifier-spread-strict.case
3 // - src/generators/default/class-expr-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 as a ClassExpression element)
6 esid: prod-GeneratorMethod
7 features: [object-spread, 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 Spread Properties
26
27 PropertyDefinition[Yield]:
28 (...)
29 ...AssignmentExpression[In, ?Yield]
30
31 ---*/
32 throw "Test262: This statement should not be evaluated.";
33
34 var callCount = 0;
35
36 var C = class {*gen() {
37 callCount += 1;
38 return {
39 ...(function() {
40 var yield;
41 throw new Test262Error();
42 }()),
43 }
44 }}
45
46 var gen = C.prototype.gen;
47
48 var iter = gen();
49
50
51
52 assert.sameValue(callCount, 1);