| 1 |
// |reftest| module |
| 2 |
// Copyright (C) 2018 Valerie Young. All rights reserved. |
| 3 |
// This code is governed by the BSD license found in the LICENSE file. |
| 4 |
/*--- |
| 5 |
description: > |
| 6 |
Default exports are included in an imported module namespace object when module exported with `* as namespace` |
| 7 |
esid: sec-moduledeclarationinstantiation |
| 8 |
info: | |
| 9 |
[...] |
| 10 |
4. Let result be InnerModuleInstantiation(module, stack, 0). |
| 11 |
[...] |
| 12 |
|
| 13 |
InnerModuleInstantiation( module, stack, index ) |
| 14 |
[...] |
| 15 |
10. Perform ? ModuleDeclarationEnvironmentSetup(module). |
| 16 |
[...] |
| 17 |
|
| 18 |
ModuleDeclarationEnvironmentSetup( module ) |
| 19 |
[...] |
| 20 |
c. If in.[[ImportName]] is "*", then |
| 21 |
[...] |
| 22 |
d. Else, |
| 23 |
i. Let resolution be ? importedModule.ResolveExport(in.[[ImportName]], « »). |
| 24 |
ii. If resolution is null or "ambiguous", throw a SyntaxError exception. |
| 25 |
iii. If resolution.[[BindingName]] is "*namespace*", then |
| 26 |
1. Let namespace be ? GetModuleNamespace(resolution.[[Module]]). |
| 27 |
[...] |
| 28 |
|
| 29 |
15.2.1.18 Runtime Semantics: GetModuleNamespace |
| 30 |
|
| 31 |
[...] |
| 32 |
3. If namespace is undefined, then |
| 33 |
a. Let exportedNames be ? module.GetExportedNames(« »). |
| 34 |
[...] |
| 35 |
|
| 36 |
15.2.1.16.2 GetExportedNames |
| 37 |
|
| 38 |
[...] |
| 39 |
7. For each ExportEntry Record e in module.[[StarExportEntries]], do |
| 40 |
[...] |
| 41 |
c. For each element n of starNames, do |
| 42 |
i. If SameValue(n, "default") is false, then |
| 43 |
[...] |
| 44 |
flags: [module] |
| 45 |
features: [export-star-as-namespace-from-module] |
| 46 |
---*/ |
| 47 |
|
| 48 |
import {named} from './instn-star-props-dflt-skip-star-as-named_FIXTURE.js'; |
| 49 |
import {production} from './instn-star-props-dflt-skip-star-as-prod_FIXTURE.js'; |
| 50 |
|
| 51 |
assert('namedOther' in named); |
| 52 |
assert.sameValue( |
| 53 |
'default' in named, true, 'default specified via identifier' |
| 54 |
); |
| 55 |
|
| 56 |
assert('productionOther' in production); |
| 57 |
assert.sameValue( |
| 58 |
'default' in production, true, 'default specified via dedicated production' |
| 59 |
); |
| 60 |
|
| 61 |
reportCompare(0, 0); |