tor-browser

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

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


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