| 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 a namespace object is created. |
| 7 |
esid: sec-module-namespace-exotic-objects-get-p-receiver |
| 8 |
info: | |
| 9 |
[...] |
| 10 |
6. Let binding be ! m.ResolveExport(P, « »). |
| 11 |
7. Assert: binding is a ResolvedBinding Record. |
| 12 |
8. Let targetModule be binding.[[Module]]. |
| 13 |
9. Assert: targetModule is not undefined. |
| 14 |
10. If binding.[[BindingName]] is "*namespace*", then |
| 15 |
11. Return ? GetModuleNamespace(targetModule). |
| 16 |
|
| 17 |
Runtime Semantics: GetModuleNamespace |
| 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 |
[...] |
| 29 |
flags: [module] |
| 30 |
features: [export-star-as-namespace-from-module] |
| 31 |
---*/ |
| 32 |
|
| 33 |
import * as namedns1 from './get-nested-namespace-dflt-skip-named_FIXTURE.js'; |
| 34 |
import * as productionns1 from './get-nested-namespace-dflt-skip-prod_FIXTURE.js'; |
| 35 |
|
| 36 |
assert('namedOther' in namedns1.namedns2); |
| 37 |
assert.sameValue( |
| 38 |
'default' in namedns1.namedns2, true, 'default specified via identifier' |
| 39 |
); |
| 40 |
|
| 41 |
assert('productionOther' in productionns1.productionns2); |
| 42 |
assert.sameValue( |
| 43 |
'default' in productionns1.productionns2, true, 'default specified via dedicated production' |
| 44 |
); |
| 45 |
|
| 46 |
reportCompare(0, 0); |