Skip to content

Commit

Permalink
export-ns: default skipped for nested namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Valerie R Young committed Apr 24, 2018
1 parent 917eb6c commit c4ac233
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

var x;
export var namedOther = null;
export { x as default };
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

export * as namedns2 from './get-nested-namespace-dflt-skip-named-end_FIXTURE.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

export var productionOther = null;
export default null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

export * as productionns2 from './get-nested-namespace-dflt-skip-prod-end_FIXTURE.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Default exports are not included in an imported module namespace object when a namespace object is created.
esid: sec-module-namespace-exotic-objects-get-p-receiver
info: |
[...]
6. Let binding be ! m.ResolveExport(P, « »).
7. Assert: binding is a ResolvedBinding Record.
8. Let targetModule be binding.[[Module]].
9. Assert: targetModule is not undefined.
10. If binding.[[BindingName]] is "*namespace*", then
11. Return ? GetModuleNamespace(targetModule).
Runtime Semantics: GetModuleNamespace
[...]
3. If namespace is undefined, then
a. Let exportedNames be ? module.GetExportedNames(« »).
b. Let unambiguousNames be a new empty List.
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
[...]
flags: [module]
---*/

import * as namedns1 from './get-nested-namespace-dflt-skip-named_FIXTURE.js';
import * as productionns1 from './get-nested-namespace-dflt-skip-prod_FIXTURE.js';

assert('namedOther' in namedns1.namedns2);
assert.sameValue(
'default' in namedns1.namedns2, false, 'default specified via identifier'
);

assert('productionOther' in productionns1.productionns2);
assert.sameValue(
'default' in productionns1.productionns2, false, 'default specified via dedicated production'
);

0 comments on commit c4ac233

Please sign in to comment.