mirror of https://github.com/tc39/test262.git
Generate tests
This commit is contained in:
parent
cce2f219f0
commit
1eb6c6a546
|
@ -0,0 +1,177 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-define-own-property.case
|
||||
// - src/dynamic-import/namespace/await.template
|
||||
/*---
|
||||
description: The [[DefineOwnProperty]] internal method returns `true` if no change is requested, and `false` otherwise. (value from await resolving)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [Symbol.iterator, Reflect, Symbol, Symbol.toStringTag, dynamic-import]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
---*/
|
||||
var sym = Symbol('test262');
|
||||
|
||||
const exported = ['local1', 'renamed', 'indirect'];
|
||||
|
||||
|
||||
async function fn() {
|
||||
const ns = await import('./define-own-property_FIXTURE.js');
|
||||
|
||||
// Non-existant properties.
|
||||
|
||||
for (const key of ['local2', 0, sym, Symbol.iterator]) {
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, key, {}),
|
||||
false,
|
||||
'Reflect.defineProperty: ' + key.toString()
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, key, {});
|
||||
}, 'Object.defineProperty: ' + key.toString());
|
||||
}
|
||||
|
||||
// Own properties. No change requested.
|
||||
|
||||
for (const key of ([...exported, Symbol.toStringTag])) {
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, key, {}),
|
||||
true,
|
||||
`No change requested, Reflect.defineProperty: ${key.toString()}`
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.defineProperty(ns, key, {}),
|
||||
ns,
|
||||
`No change requested, Object.defineProperty: ${key.toString()}`
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'indirect',
|
||||
{writable: true, enumerable: true, configurable: false}),
|
||||
true,
|
||||
'Reflect.defineProperty: indirect'
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.defineProperty(ns, 'indirect',
|
||||
{writable: true, enumerable: true, configurable: false}),
|
||||
ns,
|
||||
'Object.defineProperty: indirect'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, Symbol.toStringTag,
|
||||
{value: "Module", writable: false, enumerable: false,
|
||||
configurable: false}),
|
||||
true,
|
||||
'Reflect.defineProperty: Symbol.toStringTag'
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.defineProperty(ns, Symbol.toStringTag,
|
||||
{value: "Module", writable: false, enumerable: false,
|
||||
configurable: false}),
|
||||
ns,
|
||||
'Object.defineProperty: Symbol.toStringTag'
|
||||
);
|
||||
|
||||
|
||||
// Own properties. Change requested.
|
||||
|
||||
for (const key of ([...exported, Symbol.toStringTag])) {
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, key, {value: 123}),
|
||||
false,
|
||||
`Change requested, Reflect.defineProperty: ${key.toString()}`
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, key, {value: 123});
|
||||
}, `Change requested, Object.defineProperty: ${key.toString()}`);
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'indirect',
|
||||
{writable: true, enumerable: true, configurable: true}),
|
||||
false,
|
||||
'Reflect.defineProperty: indirect'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, 'indirect',
|
||||
{writable: true, enumerable: true, configurable: true});
|
||||
}, 'Object.defineProperty: indirect');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, Symbol.toStringTag,
|
||||
{value: "module", writable: false, enumerable: false,
|
||||
configurable: false}),
|
||||
false,
|
||||
'Reflect.defineProperty: Symbol.toStringTag'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, Symbol.toStringTag,
|
||||
{value: "module", writable: false, enumerable: false,
|
||||
configurable: false});
|
||||
}, 'Object.defineProperty: Symbol.toStringTag');
|
||||
}
|
||||
|
||||
fn().then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,106 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-delete-exported-init-no-strict.case
|
||||
// - src/dynamic-import/namespace/await.template
|
||||
/*---
|
||||
description: The [[Delete]] behavior for a key that describes an initialized exported binding on non strict mode (value from await resolving)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [dynamic-import]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryDelete(O, P).
|
||||
3. Let exports be O.[[Exports]].
|
||||
4. If P is an element of exports, return false.
|
||||
5. Return true.
|
||||
|
||||
---*/
|
||||
|
||||
async function fn() {
|
||||
const ns = await import('./delete-exported-init_FIXTURE.js');
|
||||
|
||||
assert.sameValue(delete ns.local1, false, 'delete: local1');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
|
||||
);
|
||||
assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
|
||||
|
||||
assert.sameValue(delete ns.renamed, false, 'delete: renamed');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
|
||||
);
|
||||
assert.sameValue(ns.renamed, 444, 'binding unmodified: renamed');
|
||||
|
||||
assert.sameValue(delete ns.indirect, false, 'delete: indirect');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'indirect'),
|
||||
false,
|
||||
'Reflect.deleteProperty: indirect'
|
||||
);
|
||||
assert.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
|
||||
}
|
||||
|
||||
fn().then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,112 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-delete-exported-init-strict.case
|
||||
// - src/dynamic-import/namespace/await.template
|
||||
/*---
|
||||
description: The [[Delete]] behavior for a key that describes an initialized exported binding on strict mode (value from await resolving)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [dynamic-import]
|
||||
flags: [generated, onlyStrict, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryDelete(O, P).
|
||||
3. Let exports be O.[[Exports]].
|
||||
4. If P is an element of exports, return false.
|
||||
5. Return true.
|
||||
|
||||
---*/
|
||||
|
||||
async function fn() {
|
||||
const ns = await import('./delete-exported-init_FIXTURE.js');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.local1;
|
||||
}, 'delete: local1');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
|
||||
);
|
||||
assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.renamed;
|
||||
}, 'delete: renamed');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
|
||||
);
|
||||
assert.sameValue(ns.renamed, 444, 'binding unmodified: renamed');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.indirect;
|
||||
}, 'delete: indirect');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'indirect'),
|
||||
false,
|
||||
'Reflect.deleteProperty: indirect'
|
||||
);
|
||||
assert.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
|
||||
}
|
||||
|
||||
fn().then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,104 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-delete-non-exported-no-strict.case
|
||||
// - src/dynamic-import/namespace/await.template
|
||||
/*---
|
||||
description: The [[Delete]] behavior for a key that does not describe an exported binding (value from await resolving)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [dynamic-import]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryDelete(O, P).
|
||||
3. Let exports be O.[[Exports]].
|
||||
4. If P is an element of exports, return false.
|
||||
5. Return true.
|
||||
|
||||
---*/
|
||||
|
||||
async function fn() {
|
||||
const ns = await import('./empty_FIXTURE.js');
|
||||
|
||||
assert(delete ns.undef, 'delete: undef');
|
||||
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
|
||||
|
||||
assert(delete ns.default, 'delete: default');
|
||||
assert(
|
||||
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
|
||||
);
|
||||
|
||||
assert.sameValue(delete ns[Symbol.toStringTag], false, 'delete: Symbol.toStringTag');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, Symbol.toStringTag), false,
|
||||
'Reflect.deleteProperty: Symbol.toStringTag'
|
||||
);
|
||||
|
||||
var sym = Symbol('test262');
|
||||
assert(delete ns[sym], 'delete: symbol');
|
||||
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
|
||||
}
|
||||
|
||||
fn().then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,104 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-delete-non-exported-strict.case
|
||||
// - src/dynamic-import/namespace/await.template
|
||||
/*---
|
||||
description: The [[Delete]] behavior for a key that does not describe an exported binding (value from await resolving)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [dynamic-import]
|
||||
flags: [generated, onlyStrict, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryDelete(O, P).
|
||||
3. Let exports be O.[[Exports]].
|
||||
4. If P is an element of exports, return false.
|
||||
5. Return true.
|
||||
|
||||
---*/
|
||||
|
||||
async function fn() {
|
||||
const ns = await import('./empty_FIXTURE.js');
|
||||
|
||||
assert(delete ns.undef, 'delete: undef');
|
||||
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
|
||||
|
||||
assert(delete ns.default, 'delete: default');
|
||||
assert(
|
||||
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, Symbol.toStringTag), false,
|
||||
'Reflect.deleteProperty: Symbol.toStringTag'
|
||||
);
|
||||
assert.throws(TypeError, function() { delete ns[Symbol.toStringTag]; }, 'delete: Symbol.toStringTag');
|
||||
|
||||
var sym = Symbol('test262');
|
||||
assert(delete ns[sym], 'delete: symbol');
|
||||
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
|
||||
}
|
||||
|
||||
fn().then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,126 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-get-nested-namespace-dflt-direct.case
|
||||
// - src/dynamic-import/namespace/await.template
|
||||
/*---
|
||||
description: Direct Default exports are included in an imported module namespace object when a namespace object is created. (value from await resolving)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [export-star-as-namespace-from-module, dynamic-import]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
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).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
|
||||
async function fn() {
|
||||
const ns = await import('./get-nested-namespace-dflt-skip-prod_FIXTURE.js');
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(ns, 'productionNS2');
|
||||
|
||||
assert.sameValue(desc.enumerable, true, 'ns.productionNS2: is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.productionNS2: is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.productionNS2: is non-configurable');
|
||||
|
||||
var keys = Object.keys(ns.productionNS2);
|
||||
|
||||
assert.sameValue(keys.length, 2);
|
||||
assert.sameValue(keys[0], 'default');
|
||||
assert.sameValue(keys[1], 'productionOther');
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'productionOther');
|
||||
|
||||
assert.sameValue(desc.value, null, 'ns.productionNS2.productionOther: value is null');
|
||||
assert.sameValue(desc.enumerable, true, 'ns.productionNS2.productionOther: is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.productionNS2.productionOther: is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.productionNS2.productionOther: is non-configurable');
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'default');
|
||||
|
||||
assert.sameValue(desc.value, 42, 'ns.productionNS2.default value is 42');
|
||||
assert.sameValue(desc.enumerable, true, 'ns.productionNS2.default is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.productionNS2.default is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.productionNS2.default is non-configurable');
|
||||
}
|
||||
|
||||
fn().then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,126 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-get-nested-namespace-dflt-indirect.case
|
||||
// - src/dynamic-import/namespace/await.template
|
||||
/*---
|
||||
description: Inirect Default exports are included in an imported module namespace object when a namespace object is created. (value from await resolving)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [export-star-as-namespace-from-module, dynamic-import]
|
||||
flags: [generated, module, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
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).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
|
||||
async function fn() {
|
||||
const ns = await import('./get-nested-namespace-dflt-skip-named_FIXTURE.js');
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(ns, 'namedNS2');
|
||||
|
||||
assert.sameValue(desc.enumerable, true, 'ns.namedNS2: is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.namedNS2: is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.namedNS2: is non-configurable');
|
||||
|
||||
var keys = Object.keys(ns.namedNS2);
|
||||
|
||||
assert.sameValue(keys.length, 2);
|
||||
assert.sameValue(keys[0], 'default');
|
||||
assert.sameValue(keys[1], 'namedOther');
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'namedOther');
|
||||
|
||||
assert.sameValue(desc.value, null, 'ns.namedNS2.namedOther value is null');
|
||||
assert.sameValue(desc.enumerable, true, 'ns.namedNS2.namedOther: is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.namedNS2.namedOther: is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.namedNS2.namedOther: is non-configurable');
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'default');
|
||||
|
||||
assert.sameValue(desc.value, 42, 'ns.namedNS2.default value is 42');
|
||||
assert.sameValue(desc.enumerable, true, 'ns.namedNS2.default is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.namedNS2.default is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.namedNS2.default is non-configurable');
|
||||
}
|
||||
|
||||
fn().then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,123 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-get-nested-namespace-props-nrml.case
|
||||
// - src/dynamic-import/namespace/await.template
|
||||
/*---
|
||||
description: Module namespace object reports properties for all ExportEntries of all dependencies. (value from await resolving)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [export-star-as-namespace-from-module, dynamic-import]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
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).
|
||||
|
||||
---*/
|
||||
function hasOwnProperty(obj, property) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, property);
|
||||
}
|
||||
|
||||
|
||||
async function fn() {
|
||||
const ns = await import('./get-nested-namespace-props-nrml-1_FIXTURE.js');
|
||||
|
||||
// Export entries defined by a re-exported as exportns module
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsVarDecl'), 'starssVarDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsLetDecl'), 'starSsLetDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsConstDecl'), 'starSsConstDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsFuncDecl'), 'starAsFuncDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsGenDecl'), 'starAsGenDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsClassDecl'), 'starAsClassDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsBindingId'), 'starAsBindingId');
|
||||
assert(hasOwnProperty(ns.exportns, 'starIdName'), 'starIdName');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName'), 'starAsIndirectIdName');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName2'), 'starAsIndirectIdName2');
|
||||
assert(hasOwnProperty(ns.exportns, 'namespaceBinding'), 'namespaceBinding');
|
||||
|
||||
// Bindings that were not exported from any module
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedVar'), false, 'nonExportedVar');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedLet'), false, 'nonExportedLet');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedConst'), false, 'nonExportedConst');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedFunc'), false, 'nonExportedFunc');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedGen'), false, 'nonExportedGen');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedClass'), false, 'nonExportedClass');
|
||||
}
|
||||
|
||||
fn().then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,175 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-define-own-property.case
|
||||
// - src/dynamic-import/namespace/promise.template
|
||||
/*---
|
||||
description: The [[DefineOwnProperty]] internal method returns `true` if no change is requested, and `false` otherwise. (value from promise then)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [Symbol.iterator, Reflect, Symbol, Symbol.toStringTag, dynamic-import]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
---*/
|
||||
var sym = Symbol('test262');
|
||||
|
||||
const exported = ['local1', 'renamed', 'indirect'];
|
||||
|
||||
|
||||
import('./define-own-property_FIXTURE.js').then(ns => {
|
||||
|
||||
// Non-existant properties.
|
||||
|
||||
for (const key of ['local2', 0, sym, Symbol.iterator]) {
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, key, {}),
|
||||
false,
|
||||
'Reflect.defineProperty: ' + key.toString()
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, key, {});
|
||||
}, 'Object.defineProperty: ' + key.toString());
|
||||
}
|
||||
|
||||
// Own properties. No change requested.
|
||||
|
||||
for (const key of ([...exported, Symbol.toStringTag])) {
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, key, {}),
|
||||
true,
|
||||
`No change requested, Reflect.defineProperty: ${key.toString()}`
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.defineProperty(ns, key, {}),
|
||||
ns,
|
||||
`No change requested, Object.defineProperty: ${key.toString()}`
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'indirect',
|
||||
{writable: true, enumerable: true, configurable: false}),
|
||||
true,
|
||||
'Reflect.defineProperty: indirect'
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.defineProperty(ns, 'indirect',
|
||||
{writable: true, enumerable: true, configurable: false}),
|
||||
ns,
|
||||
'Object.defineProperty: indirect'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, Symbol.toStringTag,
|
||||
{value: "Module", writable: false, enumerable: false,
|
||||
configurable: false}),
|
||||
true,
|
||||
'Reflect.defineProperty: Symbol.toStringTag'
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.defineProperty(ns, Symbol.toStringTag,
|
||||
{value: "Module", writable: false, enumerable: false,
|
||||
configurable: false}),
|
||||
ns,
|
||||
'Object.defineProperty: Symbol.toStringTag'
|
||||
);
|
||||
|
||||
|
||||
// Own properties. Change requested.
|
||||
|
||||
for (const key of ([...exported, Symbol.toStringTag])) {
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, key, {value: 123}),
|
||||
false,
|
||||
`Change requested, Reflect.defineProperty: ${key.toString()}`
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, key, {value: 123});
|
||||
}, `Change requested, Object.defineProperty: ${key.toString()}`);
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'indirect',
|
||||
{writable: true, enumerable: true, configurable: true}),
|
||||
false,
|
||||
'Reflect.defineProperty: indirect'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, 'indirect',
|
||||
{writable: true, enumerable: true, configurable: true});
|
||||
}, 'Object.defineProperty: indirect');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, Symbol.toStringTag,
|
||||
{value: "module", writable: false, enumerable: false,
|
||||
configurable: false}),
|
||||
false,
|
||||
'Reflect.defineProperty: Symbol.toStringTag'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, Symbol.toStringTag,
|
||||
{value: "module", writable: false, enumerable: false,
|
||||
configurable: false});
|
||||
}, 'Object.defineProperty: Symbol.toStringTag');
|
||||
|
||||
}).then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,104 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-delete-exported-init-no-strict.case
|
||||
// - src/dynamic-import/namespace/promise.template
|
||||
/*---
|
||||
description: The [[Delete]] behavior for a key that describes an initialized exported binding on non strict mode (value from promise then)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [dynamic-import]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryDelete(O, P).
|
||||
3. Let exports be O.[[Exports]].
|
||||
4. If P is an element of exports, return false.
|
||||
5. Return true.
|
||||
|
||||
---*/
|
||||
|
||||
import('./delete-exported-init_FIXTURE.js').then(ns => {
|
||||
|
||||
assert.sameValue(delete ns.local1, false, 'delete: local1');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
|
||||
);
|
||||
assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
|
||||
|
||||
assert.sameValue(delete ns.renamed, false, 'delete: renamed');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
|
||||
);
|
||||
assert.sameValue(ns.renamed, 444, 'binding unmodified: renamed');
|
||||
|
||||
assert.sameValue(delete ns.indirect, false, 'delete: indirect');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'indirect'),
|
||||
false,
|
||||
'Reflect.deleteProperty: indirect'
|
||||
);
|
||||
assert.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
|
||||
|
||||
}).then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,110 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-delete-exported-init-strict.case
|
||||
// - src/dynamic-import/namespace/promise.template
|
||||
/*---
|
||||
description: The [[Delete]] behavior for a key that describes an initialized exported binding on strict mode (value from promise then)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [dynamic-import]
|
||||
flags: [generated, onlyStrict, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryDelete(O, P).
|
||||
3. Let exports be O.[[Exports]].
|
||||
4. If P is an element of exports, return false.
|
||||
5. Return true.
|
||||
|
||||
---*/
|
||||
|
||||
import('./delete-exported-init_FIXTURE.js').then(ns => {
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.local1;
|
||||
}, 'delete: local1');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
|
||||
);
|
||||
assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.renamed;
|
||||
}, 'delete: renamed');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
|
||||
);
|
||||
assert.sameValue(ns.renamed, 444, 'binding unmodified: renamed');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.indirect;
|
||||
}, 'delete: indirect');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'indirect'),
|
||||
false,
|
||||
'Reflect.deleteProperty: indirect'
|
||||
);
|
||||
assert.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
|
||||
|
||||
}).then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,102 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-delete-non-exported-no-strict.case
|
||||
// - src/dynamic-import/namespace/promise.template
|
||||
/*---
|
||||
description: The [[Delete]] behavior for a key that does not describe an exported binding (value from promise then)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [dynamic-import]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryDelete(O, P).
|
||||
3. Let exports be O.[[Exports]].
|
||||
4. If P is an element of exports, return false.
|
||||
5. Return true.
|
||||
|
||||
---*/
|
||||
|
||||
import('./empty_FIXTURE.js').then(ns => {
|
||||
|
||||
assert(delete ns.undef, 'delete: undef');
|
||||
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
|
||||
|
||||
assert(delete ns.default, 'delete: default');
|
||||
assert(
|
||||
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
|
||||
);
|
||||
|
||||
assert.sameValue(delete ns[Symbol.toStringTag], false, 'delete: Symbol.toStringTag');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, Symbol.toStringTag), false,
|
||||
'Reflect.deleteProperty: Symbol.toStringTag'
|
||||
);
|
||||
|
||||
var sym = Symbol('test262');
|
||||
assert(delete ns[sym], 'delete: symbol');
|
||||
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
|
||||
|
||||
}).then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,102 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-delete-non-exported-strict.case
|
||||
// - src/dynamic-import/namespace/promise.template
|
||||
/*---
|
||||
description: The [[Delete]] behavior for a key that does not describe an exported binding (value from promise then)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [dynamic-import]
|
||||
flags: [generated, onlyStrict, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryDelete(O, P).
|
||||
3. Let exports be O.[[Exports]].
|
||||
4. If P is an element of exports, return false.
|
||||
5. Return true.
|
||||
|
||||
---*/
|
||||
|
||||
import('./empty_FIXTURE.js').then(ns => {
|
||||
|
||||
assert(delete ns.undef, 'delete: undef');
|
||||
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
|
||||
|
||||
assert(delete ns.default, 'delete: default');
|
||||
assert(
|
||||
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, Symbol.toStringTag), false,
|
||||
'Reflect.deleteProperty: Symbol.toStringTag'
|
||||
);
|
||||
assert.throws(TypeError, function() { delete ns[Symbol.toStringTag]; }, 'delete: Symbol.toStringTag');
|
||||
|
||||
var sym = Symbol('test262');
|
||||
assert(delete ns[sym], 'delete: symbol');
|
||||
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
|
||||
|
||||
}).then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,124 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-get-nested-namespace-dflt-direct.case
|
||||
// - src/dynamic-import/namespace/promise.template
|
||||
/*---
|
||||
description: Direct Default exports are included in an imported module namespace object when a namespace object is created. (value from promise then)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [export-star-as-namespace-from-module, dynamic-import]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
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).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
|
||||
import('./get-nested-namespace-dflt-skip-prod_FIXTURE.js').then(ns => {
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(ns, 'productionNS2');
|
||||
|
||||
assert.sameValue(desc.enumerable, true, 'ns.productionNS2: is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.productionNS2: is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.productionNS2: is non-configurable');
|
||||
|
||||
var keys = Object.keys(ns.productionNS2);
|
||||
|
||||
assert.sameValue(keys.length, 2);
|
||||
assert.sameValue(keys[0], 'default');
|
||||
assert.sameValue(keys[1], 'productionOther');
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'productionOther');
|
||||
|
||||
assert.sameValue(desc.value, null, 'ns.productionNS2.productionOther: value is null');
|
||||
assert.sameValue(desc.enumerable, true, 'ns.productionNS2.productionOther: is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.productionNS2.productionOther: is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.productionNS2.productionOther: is non-configurable');
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'default');
|
||||
|
||||
assert.sameValue(desc.value, 42, 'ns.productionNS2.default value is 42');
|
||||
assert.sameValue(desc.enumerable, true, 'ns.productionNS2.default is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.productionNS2.default is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.productionNS2.default is non-configurable');
|
||||
|
||||
}).then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,124 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-get-nested-namespace-dflt-indirect.case
|
||||
// - src/dynamic-import/namespace/promise.template
|
||||
/*---
|
||||
description: Inirect Default exports are included in an imported module namespace object when a namespace object is created. (value from promise then)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [export-star-as-namespace-from-module, dynamic-import]
|
||||
flags: [generated, module, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
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).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
|
||||
import('./get-nested-namespace-dflt-skip-named_FIXTURE.js').then(ns => {
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(ns, 'namedNS2');
|
||||
|
||||
assert.sameValue(desc.enumerable, true, 'ns.namedNS2: is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.namedNS2: is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.namedNS2: is non-configurable');
|
||||
|
||||
var keys = Object.keys(ns.namedNS2);
|
||||
|
||||
assert.sameValue(keys.length, 2);
|
||||
assert.sameValue(keys[0], 'default');
|
||||
assert.sameValue(keys[1], 'namedOther');
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'namedOther');
|
||||
|
||||
assert.sameValue(desc.value, null, 'ns.namedNS2.namedOther value is null');
|
||||
assert.sameValue(desc.enumerable, true, 'ns.namedNS2.namedOther: is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.namedNS2.namedOther: is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.namedNS2.namedOther: is non-configurable');
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'default');
|
||||
|
||||
assert.sameValue(desc.value, 42, 'ns.namedNS2.default value is 42');
|
||||
assert.sameValue(desc.enumerable, true, 'ns.namedNS2.default is enumerable');
|
||||
assert.sameValue(desc.writable, true, 'ns.namedNS2.default is writable');
|
||||
assert.sameValue(desc.configurable, false, 'ns.namedNS2.default is non-configurable');
|
||||
|
||||
}).then($DONE, $DONE).catch($DONE);
|
|
@ -0,0 +1,121 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dynamic-import/ns-get-nested-namespace-props-nrml.case
|
||||
// - src/dynamic-import/namespace/promise.template
|
||||
/*---
|
||||
description: Module namespace object reports properties for all ExportEntries of all dependencies. (value from promise then)
|
||||
esid: sec-finishdynamicimport
|
||||
features: [export-star-as-namespace-from-module, dynamic-import]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
|
||||
|
||||
1. If completion is an abrupt completion, ...
|
||||
2. Otherwise,
|
||||
...
|
||||
d. Let namespace be GetModuleNamespace(moduleRecord).
|
||||
e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
|
||||
f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
|
||||
|
||||
Runtime Semantics: GetModuleNamespace ( module )
|
||||
|
||||
...
|
||||
3. Let namespace be module.[[Namespace]].
|
||||
4. 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, do
|
||||
i. Let resolution be ? module.ResolveExport(name, « »).
|
||||
ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
|
||||
d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
|
||||
5. Return namespace.
|
||||
|
||||
ModuleNamespaceCreate ( module, exports )
|
||||
|
||||
...
|
||||
4. Let M be a newly created object.
|
||||
5. Set M's essential internal methods to the definitions specified in 9.4.6.
|
||||
7. Let sortedExports be a new List containing the same values as the list exports where the
|
||||
values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
|
||||
using undefined as comparefn.
|
||||
8. Set M.[[Exports]] to sortedExports.
|
||||
9. Create own properties of M corresponding to the definitions in 26.3.
|
||||
10. Set module.[[Namespace]] to M.
|
||||
11. Return M.
|
||||
|
||||
26.3 Module Namespace Objects
|
||||
|
||||
A Module Namespace Object is a module namespace exotic object that provides runtime
|
||||
property-based access to a module's exported bindings. There is no constructor function for
|
||||
Module Namespace Objects. Instead, such an object is created for each module that is imported
|
||||
by an ImportDeclaration that includes a NameSpaceImport.
|
||||
|
||||
In addition to the properties specified in 9.4.6 each Module Namespace Object has the
|
||||
following own property:
|
||||
|
||||
26.3.1 @@toStringTag
|
||||
|
||||
The initial value of the @@toStringTag property is the String value "Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
Module Namespace Exotic Objects
|
||||
|
||||
A module namespace object is an exotic object that exposes the bindings exported from an
|
||||
ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
|
||||
own properties of a module namespace exotic object and the binding names exported by the
|
||||
Module. The exported bindings include any bindings that are indirectly exported using export *
|
||||
export items. Each String-valued own property key is the StringValue of the corresponding
|
||||
exported binding name. These are the only String-keyed properties of a module namespace exotic
|
||||
object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
|
||||
[[Configurable]]: false }. Module namespace objects are not extensible.
|
||||
|
||||
|
||||
[...]
|
||||
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).
|
||||
|
||||
---*/
|
||||
function hasOwnProperty(obj, property) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, property);
|
||||
}
|
||||
|
||||
|
||||
import('./get-nested-namespace-props-nrml-1_FIXTURE.js').then(ns => {
|
||||
|
||||
// Export entries defined by a re-exported as exportns module
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsVarDecl'), 'starssVarDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsLetDecl'), 'starSsLetDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsConstDecl'), 'starSsConstDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsFuncDecl'), 'starAsFuncDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsGenDecl'), 'starAsGenDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsClassDecl'), 'starAsClassDecl');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsBindingId'), 'starAsBindingId');
|
||||
assert(hasOwnProperty(ns.exportns, 'starIdName'), 'starIdName');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName'), 'starAsIndirectIdName');
|
||||
assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName2'), 'starAsIndirectIdName2');
|
||||
assert(hasOwnProperty(ns.exportns, 'namespaceBinding'), 'namespaceBinding');
|
||||
|
||||
// Bindings that were not exported from any module
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedVar'), false, 'nonExportedVar');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedLet'), false, 'nonExportedLet');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedConst'), false, 'nonExportedConst');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedFunc'), false, 'nonExportedFunc');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedGen'), false, 'nonExportedGen');
|
||||
assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedClass'), false, 'nonExportedClass');
|
||||
|
||||
}).then($DONE, $DONE).catch($DONE);
|
Loading…
Reference in New Issue