Debian Codegraph @

js/src/tests/test262/language/arguments-object/func-decl-args-trailing-comma-undefined.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/arguments/args-trailing-comma-undefined.case
3 // - src/arguments/default/func-decl.template
4 /*---
5 description: A trailing comma after undefined should not increase the arguments.length (function declaration)
6 esid: sec-arguments-exotic-objects
7 flags: [generated]
8 info: |
9 9.4.4 Arguments Exotic Objects
10
11 Most ECMAScript functions make an arguments object available to their code. Depending upon the
12 characteristics of the function definition, its arguments object is either an ordinary object
13 or an arguments exotic object.
14
15 Trailing comma in the arguments list
16
17 Left-Hand-Side Expressions
18
19 Arguments :
20 ( )
21 ( ArgumentList )
22 ( ArgumentList , )
23
24 ArgumentList :
25 AssignmentExpression
26 ... AssignmentExpression
27 ArgumentList , AssignmentExpression
28 ArgumentList , ... AssignmentExpression
29 ---*/
30
31
32 var callCount = 0;
33 // Stores a reference `ref` for case evaluation
34 function ref() {
35 assert.sameValue(arguments.length, 2);
36 assert.sameValue(arguments[0], 42);
37 assert.sameValue(arguments[1], undefined);
38 callCount = callCount + 1;
39 }
40
41 ref(42, undefined,);
42
43 assert.sameValue(callCount, 1, 'function invoked exactly once');
44
45 reportCompare(0, 0);