Debian Codegraph @

js/src/tests/test262/language/statements/function/params-trailing-comma-multiple.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/params-trailing-comma-multiple.case
3 // - src/function-forms/default/func-decl.template
4 /*---
5 description: A trailing comma should not increase the respective length, using multiple parameters (function declaration)
6 esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
7 flags: [generated]
8 info: |
9 FunctionDeclaration :
10 function BindingIdentifier ( FormalParameters ) { FunctionBody }
11
12 [...]
13 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
14 scope, strict).
15 [...]
16
17 9.2.1 [[Call]] ( thisArgument, argumentsList)
18
19 [...]
20 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
21 [...]
22
23 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
24
25 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
26 [...]
27
28 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
29
30 [...]
31 23. Let iteratorRecord be Record {[[iterator]]:
32 CreateListIterator(argumentsList), [[done]]: false}.
33 24. If hasDuplicates is true, then
34 [...]
35 25. Else,
36 b. Let formalStatus be IteratorBindingInitialization for formals with
37 iteratorRecord and env as arguments.
38 [...]
39
40 Trailing comma in the parameters list
41
42 14.1 Function Definitions
43
44 FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
45 ---*/
46
47 var callCount = 0;
48 // Stores a reference `ref` for case evaluation
49 function ref(a, b,) {
50 assert.sameValue(a, 42);
51 assert.sameValue(b, 39);
52 callCount = callCount + 1;
53 }
54
55 ref(42, 39, 1);
56
57 assert.sameValue(callCount, 1, 'function invoked exactly once');
58
59 assert.sameValue(ref.length, 2, 'length is properly set');
60
61 reportCompare(0, 0);