Debian Codegraph @

js/src/tests/test262/language/statements/class/async-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/async-generators/yield-identifier-spread-strict.case
5 // - src/async-generators/default/async-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. (Async Generator method as a ClassDeclaration element)
8 esid: prod-AsyncGeneratorMethod
9 features: [object-spread, async-iteration]
10 flags: [generated, onlyStrict]
11 negative:
12 phase: parse
13 type: SyntaxError
14 info: |
15 ClassElement :
16 MethodDefinition
17
18 MethodDefinition :
19 AsyncGeneratorMethod
20
21 Async Generator Function Definitions
22
23 AsyncGeneratorMethod :
24 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
25
26
27 Spread Properties
28
29 PropertyDefinition[Yield]:
30 (...)
31 ...AssignmentExpression[In, ?Yield]
32
33 ---*/
34 $DONOTEVALUATE();
35
36
37 var callCount = 0;
38
39 class C { async *gen() {
40 callCount += 1;
41 return {
42 ...(function() {
43 var yield;
44 throw new Test262Error();
45 }()),
46 }
47 }}
48
49 var gen = C.prototype.gen;
50
51 var iter = gen();
52
53
54
55 assert.sameValue(callCount, 1);