Debian Codegraph @

js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-skipped.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/dstr-binding/obj-ptrn-id-init-skipped.case
4 // - src/dstr-binding/default/async-gen-func-expr.template
5 /*---
6 description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function expression)
7 esid: sec-asyncgenerator-definitions-evaluation
8 features: [async-iteration]
9 flags: [generated, async]
10 info: |
11 AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
12 AsyncGeneratorBody }
13
14 [...]
15 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
16 AsyncGeneratorBody, scope, strict).
17 [...]
18
19
20 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
21
22 SingleNameBinding : BindingIdentifier Initializeropt
23
24 [...]
25 6. If Initializer is present and v is undefined, then
26 [...]
27 [...]
28 ---*/
29 var initCount = 0;
30 function counter() {
31 initCount += 1;
32 }
33
34
35 var callCount = 0;
36 var f;
37 f = async function*({ w = counter(), x = counter(), y = counter(), z = counter() }) {
38 assert.sameValue(w, null);
39 assert.sameValue(x, 0);
40 assert.sameValue(y, false);
41 assert.sameValue(z, '');
42 assert.sameValue(initCount, 0);
43 callCount = callCount + 1;
44 };
45
46 f({ w: null, x: 0, y: false, z: '' }).next().then(() => {
47 assert.sameValue(callCount, 1, 'invoked exactly once');
48 }).then($DONE, $DONE);