Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-undefined.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/dflt-params-arg-val-undefined.case
3 // - src/function-forms/default/async-gen-meth.template
4 /*---
5 description: Use of initializer when argument value is `undefined` (async generator method)
6 esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
7 features: [default-parameters, async-iteration]
8 flags: [generated, async]
9 info: |
10 AsyncGeneratorMethod :
11 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
12 { AsyncGeneratorBody }
13
14 1. Let propKey be the result of evaluating PropertyName.
15 2. ReturnIfAbrupt(propKey).
16 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
17 Otherwise let strict be false.
18 4. Let scope be the running execution context's LexicalEnvironment.
19 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
20 AsyncGeneratorBody, scope, strict).
21 [...]
22
23
24 14.1.19 Runtime Semantics: IteratorBindingInitialization
25
26 FormalsList : FormalsList , FormalParameter
27
28 [...]
29 23. Let iteratorRecord be Record {[[Iterator]]:
30 CreateListIterator(argumentsList), [[Done]]: false}.
31 24. If hasDuplicates is true, then
32 [...]
33 25. Else,
34 a. Perform ? IteratorBindingInitialization for formals with
35 iteratorRecord and env as arguments.
36 [...]
37
38 ---*/
39
40 var callCount = 0;
41 var obj = {
42 async *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
43 assert.sameValue(fromLiteral, 23);
44 assert.sameValue(fromExpr, 45);
45 assert.sameValue(fromHole, 99);
46 callCount = callCount + 1;
47 }
48 };
49
50 // Stores a reference `ref` for case evaluation
51 var ref = obj.method;
52
53 ref(undefined, void 0).next().then(() => {
54 assert.sameValue(callCount, 1, 'generator method invoked exactly once');
55 }).then($DONE, $DONE);