tor-browser

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

get-nested-namespace-props-nrml.js (2606B)


      1 // |reftest| module
      2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 description: >
      6    Module namespace object reports properties for all ExportEntries of all
      7    dependencies.
      8 esid: sec-moduledeclarationinstantiation
      9 info: |
     10  [...]
     11  12. For each ImportEntry Record in in module.[[ImportEntries]], do
     12      a. Let importedModule be ? HostResolveImportedModule(module,
     13         in.[[ModuleRequest]]).
     14      b. If in.[[ImportName]] is "*", then
     15         i. Let namespace be ? GetModuleNamespace(importedModule).
     16  [...]
     17 
     18  Runtime Semantics: GetModuleNamespace
     19    3. If namespace is undefined, then
     20       a. Let exportedNames be ? module.GetExportedNames(« »).
     21       b. Let unambiguousNames be a new empty List.
     22       c. For each name that is an element of exportedNames,
     23          i. Let resolution be ? module.ResolveExport(name, « », « »).
     24          ii. If resolution is null, throw a SyntaxError exception.
     25          iii. If resolution is not "ambiguous", append name to
     26               unambiguousNames.
     27       d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
     28 flags: [module]
     29 features: [export-star-as-namespace-from-module]
     30 ---*/
     31 
     32 import * as ns from './get-nested-namespace-props-nrml-1_FIXTURE.js';
     33 
     34 // Export entries defined by a re-exported as exportns module
     35 assert('starAsVarDecl' in ns.exportns, 'starssVarDecl');
     36 assert('starAsLetDecl' in ns.exportns, 'starSsLetDecl');
     37 assert('starAsConstDecl' in ns.exportns, 'starSsConstDecl');
     38 assert('starAsFuncDecl' in ns.exportns, 'starAsFuncDecl');
     39 assert('starAsGenDecl' in ns.exportns, 'starAsGenDecl');
     40 assert('starAsClassDecl' in ns.exportns, 'starAsClassDecl');
     41 assert('starAsBindingId' in ns.exportns, 'starAsBindingId');
     42 assert('starIdName' in ns.exportns, 'starIdName');
     43 assert('starAsIndirectIdName' in ns.exportns, 'starAsIndirectIdName');
     44 assert('starAsIndirectIdName2' in ns.exportns, 'starAsIndirectIdName2');
     45 assert('namespaceBinding' in ns.exportns, 'namespaceBinding');
     46 
     47 // Bindings that were not exported from any module
     48 assert.sameValue('nonExportedVar' in ns.exportns, false, 'nonExportedVar');
     49 assert.sameValue('nonExportedLet' in ns.exportns, false, 'nonExportedLet');
     50 assert.sameValue('nonExportedConst' in ns.exportns, false, 'nonExportedConst');
     51 assert.sameValue('nonExportedFunc' in ns.exportns, false, 'nonExportedFunc');
     52 assert.sameValue('nonExportedGen' in ns.exportns, false, 'nonExportedGen');
     53 assert.sameValue('nonExportedClass' in ns.exportns, false, 'nonExportedClass');
     54 
     55 reportCompare(0, 0);