tor-browser

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

params-trailing-comma-multiple.js (2221B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/function-forms/params-trailing-comma-multiple.case
      4 // - src/function-forms/default/cls-expr-async-meth-static.template
      5 /*---
      6 description: A trailing comma should not increase the respective length, using multiple parameters (static class expression async method)
      7 esid: sec-class-definitions-runtime-semantics-evaluation
      8 features: [async-functions]
      9 flags: [generated, async]
     10 info: |
     11    ClassExpression : class BindingIdentifieropt ClassTail
     12 
     13    1. If BindingIdentifieropt is not present, let className be undefined.
     14    2. Else, let className be StringValue of BindingIdentifier.
     15    3. Let value be the result of ClassDefinitionEvaluation of ClassTail
     16       with argument className.
     17    [...]
     18 
     19    14.5.14 Runtime Semantics: ClassDefinitionEvaluation
     20 
     21    21. For each ClassElement m in order from methods
     22      a. If IsStatic of m is false, then
     23      b. Else,
     24        Let status be the result of performing PropertyDefinitionEvaluation
     25        for m with arguments F and false.
     26    [...]
     27 
     28    Runtime Semantics: PropertyDefinitionEvaluation
     29 
     30    AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
     31 
     32    1. Let propKey be the result of evaluating PropertyName.
     33    2. ReturnIfAbrupt(propKey).
     34    3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
     35       let strict be false.
     36    4. Let scope be the LexicalEnvironment of the running execution context.
     37    5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
     38       scope, strict).
     39    [...]
     40 
     41 
     42    Trailing comma in the parameters list
     43 
     44    14.1 Function Definitions
     45 
     46    FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
     47 ---*/
     48 
     49 var callCount = 0;
     50 var C = class {
     51  static async method(a, b,) {
     52    assert.sameValue(a, 42);
     53    assert.sameValue(b, 39);
     54    callCount = callCount + 1;
     55  }
     56 }
     57 
     58 // Stores a reference `ref` for case evaluation
     59 var ref = C.method;
     60 
     61 ref(42, 39, 1).then(() => {
     62  assert.sameValue(callCount, 1, 'method invoked exactly once');
     63 }).then($DONE, $DONE);
     64 
     65 assert.sameValue(ref.length, 2, 'length is properly set');