Debian Codegraph @

js/src/tests/test262/language/arguments-object/cls-decl-async-gen-func-args-trailing-comma-spread-operator.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/arguments/args-trailing-comma-spread-operator.case
4 // - src/arguments/default/async-gen-func-decl.template
5 /*---
6 description: A trailing comma should not increase the arguments.length, using spread args (async generator function declaration)
7 esid: sec-asyncgenerator-definitions-instantiatefunctionobject
8 features: [async-iteration]
9 flags: [generated, async]
10 info: |
11 AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
12 ( FormalParameters ) { AsyncGeneratorBody }
13
14 [...]
15 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
16 scope, strict).
17 [...]
18
19
20 Trailing comma in the arguments list
21
22 Left-Hand-Side Expressions
23
24 Arguments :
25 ( )
26 ( ArgumentList )
27 ( ArgumentList , )
28
29 ArgumentList :
30 AssignmentExpression
31 ... AssignmentExpression
32 ArgumentList , AssignmentExpression
33 ArgumentList , ... AssignmentExpression
34 ---*/
35 var arr = [2, 3];
36
37
38
39 var callCount = 0;
40 // Stores a reference `ref` for case evaluation
41 async function* ref() {
42 assert.sameValue(arguments.length, 4);
43 assert.sameValue(arguments[0], 42);
44 assert.sameValue(arguments[1], 1);
45 assert.sameValue(arguments[2], 2);
46 assert.sameValue(arguments[3], 3);
47 callCount = callCount + 1;
48 }
49
50 ref(42, ...[1], ...arr,).next().then(() => {
51 assert.sameValue(callCount, 1, 'generator function invoked exactly once');
52 }).then($DONE, $DONE);