tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

cls-expr-meth-static-args-trailing-comma-undefined.js (1377B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/arguments/args-trailing-comma-undefined.case
      3 // - src/arguments/default/cls-expr-meth-static.template
      4 /*---
      5 description: A trailing comma after undefined should not increase the arguments.length (static class expression method)
      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 var C = class {
     34  static method() {
     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 
     42 C.method(42, undefined,);
     43 
     44 // Stores a reference `ref` for case evaluation
     45 var ref = C.method;
     46 
     47 assert.sameValue(callCount, 1, 'method invoked exactly once');
     48 
     49 reportCompare(0, 0);