Debian Codegraph @

js/src/tests/test262/language/statements/class/gen-method/yield-identifier-spread-strict-strict.js

raw
1 // |reftest| error:SyntaxError
2 'use strict';
3 // This file was procedurally generated from the following sources:
4 // - src/generators/yield-identifier-spread-strict.case
5 // - src/generators/default/class-decl-method.template
6 /*---
7 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 ClassDeclaration element)
8 esid: prod-GeneratorMethod
9 features: [object-spread, generators]
10 flags: [generated, onlyStrict]
11 negative:
12 phase: parse
13 type: SyntaxError
14 info: |
15 ClassElement :
16 MethodDefinition
17
18 MethodDefinition :
19 GeneratorMethod
20
21 14.4 Generator Function Definitions
22
23 GeneratorMethod :
24 * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
25
26
27 Spread Properties
28
29 PropertyDefinition[Yield]:
30 (...)
31 ...AssignmentExpression[In, ?Yield]
32
33 ---*/
34 $DONOTEVALUATE();
35
36 var callCount = 0;
37
38 class C { *gen() {
39 callCount += 1;
40 return {
41 ...(function() {
42 var yield;
43 throw new Test262Error();
44 }()),
45 }
46 }}
47
48 var gen = C.prototype.gen;
49
50 var iter = gen();
51
52
53
54 assert.sameValue(callCount, 1);