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