instn-star-props-nrml.js (3423B)
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 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 './instn-star-props-nrml-1_FIXTURE.js'; 33 34 // Export entries defined by a directly-imported module 35 assert('localVarDecl' in ns, 'localVarDecl'); 36 assert('localLetDecl' in ns, 'localLetDecl'); 37 assert('localConstDecl' in ns, 'localConstDecl'); 38 assert('localFuncDecl' in ns, 'localFuncDecl'); 39 assert('localGenDecl' in ns, 'localGenDecl'); 40 assert('localClassDecl' in ns, 'localClassDecl'); 41 assert('localBindingId' in ns, 'localBindingId'); 42 assert('localIdName' in ns, 'localIdName'); 43 assert('indirectIdName' in ns, 'indirectIdName'); 44 assert('indirectIdName2' in ns, 'indirectIdName2'); 45 assert('namespaceBinding' in ns, 'namespaceBinding'); 46 47 // Export entries defined by a re-exported module 48 assert('starVarDecl' in ns, 'starVarDecl'); 49 assert('starLetDecl' in ns, 'starLetDecl'); 50 assert('starConstDecl' in ns, 'starConstDecl'); 51 assert('starFuncDecl' in ns, 'starFuncDecl'); 52 assert('starGenDecl' in ns, 'starGenDecl'); 53 assert('starClassDecl' in ns, 'starClassDecl'); 54 assert('starBindingId' in ns, 'starBindingId'); 55 assert('starIdName' in ns, 'starIdName'); 56 assert('starIndirectIdName' in ns, 'starIndirectIdName'); 57 assert('starIndirectIdName2' in ns, 'starIndirectIdName2'); 58 assert('starIndirectNamespaceBinding' in ns, 'starIndirectNamespaceBinding'); 59 60 // Bindings that were not exported from any module 61 assert.sameValue('nonExportedVar1' in ns, false, 'nonExportedVar1'); 62 assert.sameValue('nonExportedVar2' in ns, false, 'nonExportedVar2'); 63 assert.sameValue('nonExportedLet1' in ns, false, 'nonExportedLet1'); 64 assert.sameValue('nonExportedLet2' in ns, false, 'nonExportedLet2'); 65 assert.sameValue('nonExportedConst1' in ns, false, 'nonExportedConst1'); 66 assert.sameValue('nonExportedConst2' in ns, false, 'nonExportedConst2'); 67 assert.sameValue('nonExportedFunc1' in ns, false, 'nonExportedFunc1'); 68 assert.sameValue('nonExportedFunc2' in ns, false, 'nonExportedFunc2'); 69 assert.sameValue('nonExportedGen1' in ns, false, 'nonExportedGen1'); 70 assert.sameValue('nonExportedGen2' in ns, false, 'nonExportedGen2'); 71 assert.sameValue('nonExportedClass1' in ns, false, 'nonExportedClass1'); 72 assert.sameValue('nonExportedClass2' in ns, false, 'nonExportedClass2'); 73 74 reportCompare(0, 0);