tor-browser

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

named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js (1105B)


      1 // |reftest| async
      2 'use strict';
      3 // This file was procedurally generated from the following sources:
      4 // - src/function-forms/reassign-fn-name-in-body-in-arrow.case
      5 // - src/function-forms/expr-named/async-func-expr-named-strict-error.template
      6 /*---
      7 description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in strict mode code)
      8 esid: sec-async-function-definitions
      9 features: [async-functions]
     10 flags: [generated, async, onlyStrict]
     11 includes: [asyncHelpers.js]
     12 info: |
     13    Async Function Definitions
     14 
     15    AsyncFunctionExpression :
     16      async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
     17 
     18 ---*/
     19 
     20 // increment callCount in case "body"
     21 let callCount = 0;
     22 let ref = async function BindingIdentifier() {
     23  callCount++;
     24  (() => {
     25    BindingIdentifier = 1;
     26  })();
     27  return BindingIdentifier;
     28 };
     29 
     30 asyncTest(async () => {
     31  let catchCount = 0;
     32  try {
     33    await ref()
     34  } catch (error) {
     35    catchCount++;
     36    assert(error instanceof TypeError);
     37  }
     38  assert.sameValue(catchCount, 1);
     39  assert.sameValue(callCount, 1);
     40 });