func-expr-args-trailing-comma-null.js (1291B)
1 // This file was procedurally generated from the following sources: 2 // - src/arguments/args-trailing-comma-null.case 3 // - src/arguments/default/func-expr.template 4 /*--- 5 description: A trailing comma after null should not increase the arguments.length (function expression) 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 var ref; 35 ref = function() { 36 assert.sameValue(arguments.length, 2); 37 assert.sameValue(arguments[0], 42); 38 assert.sameValue(arguments[1], null); 39 callCount = callCount + 1; 40 }; 41 42 ref(42, null,); 43 44 assert.sameValue(callCount, 1, 'function invoked exactly once'); 45 46 reportCompare(0, 0);