| 1 |
// |reftest| async |
| 2 |
// This file was procedurally generated from the following sources: |
| 3 |
// - src/dynamic-import/specifier-tostring.case |
| 4 |
// - src/dynamic-import/default/top-level.template |
| 5 |
/*--- |
| 6 |
description: ToString value of specifier (top level) |
| 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 |
Import Calls |
| 26 |
|
| 27 |
Runtime Semantics: Evaluation |
| 28 |
|
| 29 |
ImportCall : import(AssignmentExpression) |
| 30 |
|
| 31 |
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). |
| 32 |
2. Let argRef be the result of evaluating AssignmentExpression. |
| 33 |
3. Let specifier be ? GetValue(argRef). |
| 34 |
4. Let promiseCapability be ! NewPromiseCapability(%Promise%). |
| 35 |
5. Let specifierString be ToString(specifier). |
| 36 |
6. IfAbruptRejectPromise(specifierString, promiseCapability). |
| 37 |
7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). |
| 38 |
8. Return promiseCapability.[[Promise]]. |
| 39 |
|
| 40 |
---*/ |
| 41 |
// import('./module-code_FIXTURE.js') |
| 42 |
|
| 43 |
const obj = { |
| 44 |
toString() { |
| 45 |
return './module-code_FIXTURE.js'; |
| 46 |
} |
| 47 |
}; |
| 48 |
|
| 49 |
|
| 50 |
import(obj).then(imported => { |
| 51 |
|
| 52 |
assert.sameValue(imported.default, 42); |
| 53 |
assert.sameValue(imported.x, 'Test262'); |
| 54 |
assert.sameValue(imported.z, 42); |
| 55 |
|
| 56 |
}).then($DONE, $DONE).catch($DONE); |