Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object.js

raw
1 // |reftest| async
2 // Copyright (C) 2018 Leo Balter. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: >
6 Reuse the resolved namespace object instead of creating a new one
7 esid: sec-import-call-runtime-semantics-evaluation
8 info: |
9 Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
10
11 1. If completion is an abrupt completion, ...
12 2. Otherwise,
13 ...
14 d. Let namespace be GetModuleNamespace(moduleRecord).
15 e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
16 f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
17
18 Runtime Semantics: GetModuleNamespace ( module )
19
20 ...
21 3. Let namespace be module.[[Namespace]].
22 4. If namespace is undefined, then
23 ...
24 d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
25 5. Return namespace.
26 features: [dynamic-import]
27 flags: [async]
28 ---*/
29
30 Promise.all([
31 import('./dynamic-import-module_FIXTURE.js'),
32 import('./dynamic-import-module_FIXTURE.js'),
33 ]).then(([a, b]) => {
34 assert.sameValue(a, b, 'it returns the same namespace are the same');
35 }).then($DONE, $DONE);