Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/async-gen-method-static-yield-star-getiter-sync-not-callable-symbol-throw.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
3 // - src/async-generators/default/async-class-expr-static-method.template
4 /*---
5 description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Static async generator method as a ClassExpression element)
6 esid: prod-AsyncGeneratorMethod
7 features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
8 flags: [generated, async]
9 info: |
10 ClassElement :
11 static MethodDefinition
12
13 MethodDefinition :
14 AsyncGeneratorMethod
15
16 Async Generator Function Definitions
17
18 AsyncGeneratorMethod :
19 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
20
21
22 YieldExpression: yield * AssignmentExpression
23
24 1. Let exprRef be the result of evaluating AssignmentExpression.
25 2. Let value be ? GetValue(exprRef).
26 3. Let generatorKind be ! GetGeneratorKind().
27 4. Let iterator be ? GetIterator(value, generatorKind).
28 ...
29
30 GetIterator ( obj [ , hint ] )
31
32 ...
33 3. If hint is async,
34 a. Set method to ? GetMethod(obj, @@asyncIterator).
35 b. If method is undefined,
36 i. Let syncMethod be ? GetMethod(obj, @@iterator).
37 ...
38
39 GetMethod ( V, P )
40
41 ...
42 2. Let func be ? GetV(V, P).
43 ...
44 4. If IsCallable(func) is false, throw a TypeError exception.
45 ...
46
47 ---*/
48 var obj = {
49 [Symbol.iterator]: Symbol.iterator
50 };
51
52
53
54 var callCount = 0;
55
56 var C = class { static async *gen() {
57 callCount += 1;
58 yield* obj;
59 throw new Test262Error('abrupt completion closes iter');
60
61 }}
62
63 var gen = C.gen;
64
65 var iter = gen();
66
67 iter.next().then(() => {
68 throw new Test262Error('Promise incorrectly fulfilled.');
69 }, v => {
70 assert.sameValue(v.constructor, TypeError, "TypeError");
71
72 iter.next().then(({ done, value }) => {
73 assert.sameValue(done, true, 'the iterator is completed');
74 assert.sameValue(value, undefined, 'value is undefined');
75 }).then($DONE, $DONE);
76 }).catch($DONE);
77
78 assert.sameValue(callCount, 1);