Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case
4 // - src/dynamic-import/default/nested-async-function-await.template
5 /*---
6 description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async function, awaited)
7 esid: sec-import-call-runtime-semantics-evaluation
8 features: [dynamic-import]
9 flags: [generated, async]
10 info: |
11 ImportCall :
12 import( AssignmentExpression )
13
14 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
15 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
16 3. Let argRef be the result of evaluating AssignmentExpression.
17 4. Let specifier be ? GetValue(argRef).
18 5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
19 6. Let specifierString be ToString(specifier).
20 7. IfAbruptRejectPromise(specifierString, promiseCapability).
21 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
22 9. Return promiseCapability.[[Promise]].
23
24
25 GetBindingValue (N, S)
26
27 [...]
28 3. If the binding for N is an indirect binding, then
29 a. Let M and N2 be the indirection values provided when this binding for
30 N was created.
31 b. Let targetEnv be M.[[Environment]].
32 c. If targetEnv is undefined, throw a ReferenceError exception.
33 d. Let targetER be targetEnv's EnvironmentRecord.
34 e. Return ? targetER.GetBindingValue(N2, S).
35
36 ---*/
37
38 async function f() {
39 await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => {
40
41 assert.sameValue(imported.default(), 1);
42 assert.sameValue(imported.default, 2);
43
44 });
45 }
46
47 f().then($DONE, $DONE).catch($DONE);