Debian Codegraph @

js/src/tests/test262/language/expressions/function/params-trailing-comma-single.js

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