tor-browser

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

dflt-params-ref-self.js (1774B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/function-forms/dflt-params-ref-self.case
      4 // - src/function-forms/error/async-arrow-function.template
      5 /*---
      6 description: Referencing a parameter from within its own initializer (async arrow function expression)
      7 esid: sec-async-arrow-function-definitions
      8 features: [default-parameters, async-functions]
      9 flags: [generated, async]
     10 info: |
     11    14.7 Async Arrow Function Definitions
     12 
     13    AsyncArrowFunction :
     14      ...
     15      CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
     16 
     17    AsyncConciseBody :
     18      { AsyncFunctionBody }
     19 
     20    ...
     21 
     22    Supplemental Syntax
     23 
     24    When processing an instance of the production AsyncArrowFunction :
     25    CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
     26    CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
     27 
     28    AsyncArrowHead :
     29      async ArrowFormalParameters
     30 
     31 
     32    14.1.19 Runtime Semantics: IteratorBindingInitialization
     33 
     34    FormalsList : FormalsList , FormalParameter
     35 
     36    1. Let status be the result of performing IteratorBindingInitialization for
     37       FormalsList using iteratorRecord and environment as the arguments.
     38    2. ReturnIfAbrupt(status).
     39    3. Return the result of performing IteratorBindingInitialization for
     40       FormalParameter using iteratorRecord and environment as the arguments.
     41 
     42 ---*/
     43 var x = 0;
     44 
     45 
     46 var callCount = 0;
     47 var f;
     48 f = async (x = x) => {
     49  
     50  callCount = callCount + 1;
     51 };
     52 
     53 f()
     54  .then(_ => {
     55    throw new Test262Error('function should not be resolved');
     56  }, error => assert.sameValue(error.constructor, ReferenceError))
     57  .then(() => {
     58    assert.sameValue(callCount, 0, 'function body is not evaluated');
     59  }, $DONE)
     60  .then($DONE, $DONE);