tor-browser

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

dflt-params-ref-later.js (2422B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/function-forms/dflt-params-ref-later.case
      4 // - src/function-forms/error/cls-decl-async-meth.template
      5 /*---
      6 description: Referencing a parameter that occurs later in the ParameterList (class declaration async method)
      7 esid: sec-class-definitions-runtime-semantics-evaluation
      8 features: [default-parameters, 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    14.1.19 Runtime Semantics: IteratorBindingInitialization
     42 
     43    FormalsList : FormalsList , FormalParameter
     44 
     45    1. Let status be the result of performing IteratorBindingInitialization for
     46       FormalsList using iteratorRecord and environment as the arguments.
     47    2. ReturnIfAbrupt(status).
     48    3. Return the result of performing IteratorBindingInitialization for
     49       FormalParameter using iteratorRecord and environment as the arguments.
     50 
     51 ---*/
     52 var x = 0;
     53 
     54 
     55 var callCount = 0;
     56 class C {
     57  async method(x = y, y) {
     58    
     59    callCount = callCount + 1;
     60  }
     61 }
     62 
     63 C.prototype.method()
     64  .then(_ => {
     65    throw new Test262Error('function should not be resolved');
     66  }, error => assert.sameValue(error.constructor, ReferenceError))
     67  .then(() => {
     68    assert.sameValue(callCount, 0, 'function body is not evaluated');
     69  }, $DONE)
     70  .then($DONE, $DONE);