nested-block-labeled-eval-script-code-target.js (1641B)
1 // |reftest| module async 2 // This file was procedurally generated from the following sources: 3 // - src/dynamic-import/eval-script-code-target.case 4 // - src/dynamic-import/catch/nested-block-labeled.template 5 /*--- 6 description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested block syntax) 7 esid: sec-import-call-runtime-semantics-evaluation 8 features: [dynamic-import] 9 flags: [generated, module, 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 Modules 26 27 Static Semantics: Early Errors 28 29 ModuleBody : ModuleItemList 30 - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. 31 - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. 32 33 ---*/ 34 35 label: { 36 import('./script-code_FIXTURE.js').catch(error => { 37 38 assert.sameValue(error.name, 'SyntaxError'); 39 40 }).then($DONE, $DONE); 41 };