tor-browser

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

eval-export-dflt-cls-name-meth.js (1380B)


      1 // |reftest| module async
      2 // Copyright (C) 2018 Rick Waldron. All rights reserved.
      3 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      4 // This code is governed by the BSD license found in the LICENSE file.
      5 /*---
      6 description: >
      7    Default "anonymous" class declaration containing a static `name` method is
      8    correctly initialized upon evaluation
      9 esid: sec-moduleevaluation
     10 info: |
     11    [...]
     12    16. Let result be the result of evaluating module.[[ECMAScriptCode]].
     13    [...]
     14 
     15    15.2.3.11 Runtime Semantics: Evaluation
     16 
     17    ExportDeclaration : export default ClassDeclaration
     18 
     19    [...]
     20    3. Let className be the sole element of BoundNames of ClassDeclaration.
     21    4. If className is "*default*", then
     22       a. Let hasNameProperty be ? HasOwnProperty(value, "name").
     23       b. If hasNameProperty is false, perform SetFunctionName(value,
     24          "default").
     25       c. Let env be the running execution context's LexicalEnvironment.
     26       d. Perform ? InitializeBoundName("*default*", value, env).
     27    5. Return NormalCompletion(empty).
     28 flags: [async, module]
     29 features: [dynamic-import]
     30 ---*/
     31 
     32 export default class { static name() { return 'name method'; } }
     33 import('./eval-export-dflt-cls-name-meth.js').then(imported => {
     34  assert.sameValue(imported.default.name(), 'name method', '`name` property is not over-written');
     35 }).then($DONE, $DONE).catch($DONE);