tor-browser

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

params-trailing-comma-single.js (1772B)


      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-decl.template
      4 /*---
      5 description: A trailing comma should not increase the respective length, using a single parameter (function declaration)
      6 esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
      7 flags: [generated]
      8 info: |
      9    FunctionDeclaration :
     10        function BindingIdentifier ( FormalParameters ) { FunctionBody }
     11 
     12        [...]
     13        3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
     14           scope, strict).
     15        [...]
     16 
     17    9.2.1 [[Call]] ( thisArgument, argumentsList)
     18 
     19    [...]
     20    7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
     21    [...]
     22 
     23    9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
     24 
     25    1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
     26    [...]
     27 
     28    9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
     29 
     30    [...]
     31    23. Let iteratorRecord be Record {[[iterator]]:
     32        CreateListIterator(argumentsList), [[done]]: false}.
     33    24. If hasDuplicates is true, then
     34        [...]
     35    25. Else,
     36        b. Let formalStatus be IteratorBindingInitialization for formals with
     37           iteratorRecord and env as arguments.
     38    [...]
     39 
     40    Trailing comma in the parameters list
     41 
     42    14.1 Function Definitions
     43 
     44    FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
     45 ---*/
     46 
     47 var callCount = 0;
     48 // Stores a reference `ref` for case evaluation
     49 function ref(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);