-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
export-ns: success case for initializing nested namespace
- Loading branch information
Valerie R Young
committed
Apr 20, 2018
1 parent
b33324a
commit 4c6bb69
Showing
4 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
test/language/module-code/namespace/internals/get-nested-namespace-props-nrml-1_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 exportns from './get-nested-namespace-props-nrml-2_FIXTURE.js'; |
23 changes: 23 additions & 0 deletions
23
test/language/module-code/namespace/internals/get-nested-namespace-props-nrml-2_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
var notExportedVar; | ||
let notExportedLet; | ||
const notExportedConst = null; | ||
function notExportedFunc() {} | ||
function* notExportedGen() {} | ||
class notExportedClass {} | ||
|
||
var starBindingId; | ||
|
||
export var starAsVarDecl; | ||
export let starAsLetDecl; | ||
export const starAsConstDecl = null; | ||
export function starAsFuncDecl() {} | ||
export function* starAsGenDecl() {} | ||
export class starAsClassDecl {} | ||
export { starAsBindingId }; | ||
export { starAsBindingId as starIdName }; | ||
export { starAsIndirectIdName } from './get-nested-namespace-props-nrml-3_FIXTURE.js'; | ||
export { starAsIndirectIdName as starAsIndirectIdName2 } from './get-nested-namespace-props-nrml-3_FIXTURE.js'; | ||
export * as namespaceBinding from './get-nested-namespace-props-nrml-3_FIXTURE.js';; |
5 changes: 5 additions & 0 deletions
5
test/language/module-code/namespace/internals/get-nested-namespace-props-nrml-3_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (C) 2016 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
export var indirectIdName; | ||
export var starIndirectIdName; |
51 changes: 51 additions & 0 deletions
51
test/language/module-code/namespace/internals/get-nested-namespace-props-nrml.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (C) 2016 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: > | ||
Module namespace object reports properties for all ExportEntries of all | ||
dependencies. | ||
esid: sec-moduledeclarationinstantiation | ||
info: | | ||
[...] | ||
12. For each ImportEntry Record in in module.[[ImportEntries]], do | ||
a. Let importedModule be ? HostResolveImportedModule(module, | ||
in.[[ModuleRequest]]). | ||
b. If in.[[ImportName]] is "*", then | ||
i. Let namespace be ? GetModuleNamespace(importedModule). | ||
[...] | ||
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 ns from './get-nested-namespace-props-nrml-1_FIXTURE.js'; | ||
|
||
// Export entries defined by a re-exported as exportns module | ||
assert('starAsVarDecl' in ns.exportns, 'starssVarDecl'); | ||
assert('starAsLetDecl' in ns.exportns, 'starSsLetDecl'); | ||
assert('starAsConstDecl' in ns.exportns, 'starSsConstDecl'); | ||
assert('starAsFuncDecl' in ns.exportns, 'starAsFuncDecl'); | ||
assert('starAsGenDecl' in ns.exportns, 'starAsGenDecl'); | ||
assert('starAsClassDecl' in ns.exportns, 'starAsClassDecl'); | ||
assert('starAsBindingId' in ns.exportns, 'starAsBindingId'); | ||
assert('starAsIdName' in ns.exportns, 'starAsIdName'); | ||
assert('starAsIndirectIdName' in ns.exportns, 'starAsIndirectIdName'); | ||
assert('starAsIndirectIdName2' in ns.exportns, 'starAsIndirectIdName2'); | ||
assert('namespaceBinding' in ns.exportns, 'namespaceBinding'); | ||
|
||
// Bindings that were not exported from any module | ||
assert.sameValue('nonExportedVar' in ns.exportns, false, 'nonExportedVar'); | ||
assert.sameValue('nonExportedLet' in ns.exportns, false, 'nonExportedLet'); | ||
assert.sameValue('nonExportedConst' in ns.exportns, false, 'nonExportedConst'); | ||
assert.sameValue('nonExportedFunc' in ns.exportns, false, 'nonExportedFunc'); | ||
assert.sameValue('nonExportedGen' in ns.exportns, false, 'nonExportedGen'); | ||
assert.sameValue('nonExportedClass' in ns.exportns, false, 'nonExportedClass'); |