test262/test/language/expressions/dynamic-import/catch/nested-if-import-catch-eval...

41 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-08-10 21:14:38 +02:00
// This file was procedurally generated from the following sources:
2018-10-09 20:17:35 +02:00
// - src/dynamic-import/eval-script-code-target.case
// - src/dynamic-import/catch/nested-if.template
2018-08-10 21:14:38 +02:00
/*---
2018-10-09 20:17:35 +02:00
description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested if)
2018-08-10 21:14:38 +02:00
esid: sec-import-call-runtime-semantics-evaluation
features: [dynamic-import]
2018-10-09 20:17:35 +02:00
flags: [generated, module, async]
2018-08-10 21:14:38 +02:00
info: |
ImportCall :
import( AssignmentExpression )
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
3. Let argRef be the result of evaluating AssignmentExpression.
4. Let specifier be ? GetValue(argRef).
5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
6. Let specifierString be ToString(specifier).
7. IfAbruptRejectPromise(specifierString, promiseCapability).
8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
9. Return promiseCapability.[[Promise]].
2018-10-09 20:17:35 +02:00
Modules
Static Semantics: Early Errors
ModuleBody : ModuleItemList
- It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries.
- It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
2018-08-10 21:14:38 +02:00
---*/
if (true) {
2018-10-09 20:17:35 +02:00
import('./script-code_FIXTURE.js').catch(error => {
2018-08-10 21:14:38 +02:00
2018-10-09 20:17:35 +02:00
assert.sameValue(error.name, 'SyntaxError');
2018-08-10 21:14:38 +02:00
2018-10-09 20:17:35 +02:00
}).then($DONE, $DONE);
2018-08-10 21:14:38 +02:00
}