diff --git a/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..e20fea77bb --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +let f = () => { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-await-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-async-function-await-file-does-not-exist.js new file mode 100644 index 0000000000..dc7aed766d --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-await-file-does-not-exist.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +async function f() { + await import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-async-function-file-does-not-exist.js new file mode 100644 index 0000000000..cb69b14cef --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-file-does-not-exist.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +async function f() { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist.js new file mode 100644 index 0000000000..9ed17fc2f2 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +async function f() { + return await import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-block-import-catch-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..b15eca60ac --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-file-does-not-exist.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +{ + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-block-labeled-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-block-labeled-file-does-not-exist.js new file mode 100644 index 0000000000..b111ce36c0 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-labeled-file-does-not-exist.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +label: { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-do-while-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-do-while-file-does-not-exist.js new file mode 100644 index 0000000000..7dd7497a8a --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-do-while-file-does-not-exist.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +do { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/catch/nested-else-import-catch-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..089f06a196 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-file-does-not-exist.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +if (false) { + +} else { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-function-import-catch-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..ba5f1660af --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-file-does-not-exist.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +function f() { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-if-import-catch-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..623ae71662 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-file-does-not-exist.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +if (true) { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-while-import-catch-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..671238e7c3 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-file-does-not-exist.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +let x = 0; +while (!x) { + x++; + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-with-import-catch-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..cf8b175614 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-with.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +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]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +with ({}) { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} + \ No newline at end of file diff --git a/test/language/module-code/dynamic-import/catch/nested-with-import-catch-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..7544674b0b --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-with.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +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]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +with ({}) { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} + \ No newline at end of file diff --git a/test/language/module-code/dynamic-import/catch/nested-with-import-catch-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..082c42f568 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-file-does-not-exist.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-with.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +with ({}) { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} + \ No newline at end of file diff --git a/test/language/module-code/dynamic-import/catch/nested-with-import-catch-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..028e8d5104 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-with.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +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]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +with ({}) { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + \ No newline at end of file diff --git a/test/language/module-code/dynamic-import/catch/nested-with-import-catch-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000..07dd99c501 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-with-import-catch-instn-iee-err-circular.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-with.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +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]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +with ({}) { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + \ No newline at end of file diff --git a/test/language/module-code/dynamic-import/catch/top-level-import-catch-file-does-not-exist.js b/test/language/module-code/dynamic-import/catch/top-level-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..cbf8c69132 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/top-level-import-catch-file-does-not-exist.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + +}).then($DONE, $DONE); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js index 96a8bb6247..1c22154efb 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js index 825bdf5c31..cffc0b81b8 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args.js new file mode 100644 index 0000000000..649537df22 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +let f = () => import('', ''); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..f567a656b6 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-no-trailing-comma.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall is not extensible - trailing comma (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +let f = () => import('',); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args.js new file mode 100644 index 0000000000..892ba946de --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-arrow.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +let f = () => { + import('', ''); +}; diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..7a1ac82403 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-arrow.template +/*--- +description: ImportCall is not extensible - trailing comma (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +let f = () => { + import('',); +}; diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js index 622142e849..43fd7992b2 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js index f36a527edc..3bf5594035 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args.js new file mode 100644 index 0000000000..95af703720 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-function-await.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + await import('', ''); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..610e918d46 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-async-function-await.template +/*--- +description: ImportCall is not extensible - trailing comma (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + await import('',); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args.js new file mode 100644 index 0000000000..91dd884497 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-function.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + import('', ''); +} + diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..db47b50c3a --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-not-extensible-no-trailing-comma.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-async-function.template +/*--- +description: ImportCall is not extensible - trailing comma (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + import('',); +} + diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js index e4bc337d8c..7663c36529 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args.js new file mode 100644 index 0000000000..a91e9d1f63 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + return await import('', ''); +} + diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..873820d410 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-no-trailing-comma.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +/*--- +description: ImportCall is not extensible - trailing comma (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + return await import('',); +} + diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js index 7867d2a4e9..a4691ca71d 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested block syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js index 6296b903bc..6932f7797e 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested block syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args.js new file mode 100644 index 0000000000..1823f1486d --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-block-labeled.template +/*--- +description: ImportCall is not extensible - no arguments list (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +label: { + import('', ''); +}; diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..774d853665 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-block-labeled.template +/*--- +description: ImportCall is not extensible - trailing comma (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +label: { + import('',); +}; diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-not-extensible-args.js new file mode 100644 index 0000000000..84e1499005 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-block.template +/*--- +description: ImportCall is not extensible - no arguments list (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +{ + import('', ''); +}; diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..a73878a6b4 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-block.template +/*--- +description: ImportCall is not extensible - trailing comma (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +{ + import('',); +}; diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js index a1bbe92af5..d1b92fee08 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested do while syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args.js new file mode 100644 index 0000000000..48a8ee93b7 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-do-while.template +/*--- +description: ImportCall is not extensible - no arguments list (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +do { + import('', ''); +} while (false); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..33224be168 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-do-while.template +/*--- +description: ImportCall is not extensible - trailing comma (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +do { + import('',); +} while (false); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js index 00dce8cf5c..83ba3db765 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested else syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js index 1e691f817d..11e7beec89 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested else syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args.js new file mode 100644 index 0000000000..d2eab4c9a0 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-else-braceless.template +/*--- +description: ImportCall is not extensible - no arguments list (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (false) { + +} else import('', ''); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..69510347fa --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-else-braceless.template +/*--- +description: ImportCall is not extensible - trailing comma (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (false) { + +} else import('',); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-not-extensible-args.js new file mode 100644 index 0000000000..4290f00c5f --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-not-extensible-args.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: ImportCall is not extensible - no arguments list (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (false) { + +} else { + import('', ''); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..f94c5105a1 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-not-extensible-no-trailing-comma.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: ImportCall is not extensible - trailing comma (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (false) { + +} else { + import('',); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js index 4873ae664c..a6c48c3928 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested function syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-not-extensible-args.js new file mode 100644 index 0000000000..5748b12dc3 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-function.template +/*--- +description: ImportCall is not extensible - no arguments list (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +function fn() { + import('', ''); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..e5b898ea2c --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-function.template +/*--- +description: ImportCall is not extensible - trailing comma (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +function fn() { + import('',); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js index 4a10c5de24..042677a789 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested function syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args.js new file mode 100644 index 0000000000..9d80e2f20f --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-function-return.template +/*--- +description: ImportCall is not extensible - no arguments list (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +function fn() { + return import('', ''); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..298b979ae0 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-function-return.template +/*--- +description: ImportCall is not extensible - trailing comma (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +function fn() { + return import('',); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js index d0a3ff0af4..c00eccbbb9 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested if syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js index af0f9caa7e..a53086c259 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested if syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args.js new file mode 100644 index 0000000000..713d0ac65e --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-if-braceless.template +/*--- +description: ImportCall is not extensible - no arguments list (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (true) import('', ''); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..ac7e9aa750 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-no-trailing-comma.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-if-braceless.template +/*--- +description: ImportCall is not extensible - trailing comma (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (true) import('',); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-not-extensible-args.js new file mode 100644 index 0000000000..98180c77ab --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-if.template +/*--- +description: ImportCall is not extensible - no arguments list (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (true) { + import('', ''); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..87c91b7b53 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-if.template +/*--- +description: ImportCall is not extensible - trailing comma (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (true) { + import('',); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js index 25cdafb6f5..478a5f5744 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (nested while syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-while-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-while-not-extensible-args.js new file mode 100644 index 0000000000..d41674b4a0 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-while-not-extensible-args.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: ImportCall is not extensible - no arguments list (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +let x = 0; +while (!x) { + x++; + import('', ''); +}; diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-while-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-while-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..69cb2c1814 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-while-not-extensible-no-trailing-comma.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: ImportCall is not extensible - trailing comma (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +let x = 0; +while (!x) { + x++; + import('',); +}; diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional.js new file mode 100644 index 0000000000..be620c5666 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-with.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +with ({}) { + import(); +} + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-with-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-with-not-extensible-args.js new file mode 100644 index 0000000000..6c43a0d1f4 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-with-not-extensible-args.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-with.template +/*--- +description: ImportCall is not extensible - no arguments list (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +with ({}) { + import('', ''); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-with-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-with-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..ecafdd9455 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-with-not-extensible-no-trailing-comma.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/nested-with.template +/*--- +description: ImportCall is not extensible - trailing comma (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +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]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +with ({}) { + import('',); +} diff --git a/test/language/module-code/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js index 32810c3d8b..e0f2430577 100644 --- a/test/language/module-code/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js +++ b/test/language/module-code/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js @@ -5,7 +5,7 @@ description: It's a SyntaxError if AssignmentExpression is omitted (top level syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] negative: phase: parse type: SyntaxError diff --git a/test/language/module-code/dynamic-import/syntax/invalid/top-level-not-extensible-args.js b/test/language/module-code/dynamic-import/syntax/invalid/top-level-not-extensible-args.js new file mode 100644 index 0000000000..aa517c93ac --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/top-level-not-extensible-args.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: ImportCall is not extensible - no arguments list (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +import('', ''); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/top-level-not-extensible-no-trailing-comma.js b/test/language/module-code/dynamic-import/syntax/invalid/top-level-not-extensible-no-trailing-comma.js new file mode 100644 index 0000000000..d7c12259fc --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/top-level-not-extensible-no-trailing-comma.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-no-trailing-comma.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: ImportCall is not extensible - trailing comma (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +throw "Test262: This statement should not be evaluated."; + +import('',); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js index 7273a33e6c..a3286b57e6 100644 --- a/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js @@ -5,7 +5,7 @@ description: Calling import('') (nested arrow syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] info: | ImportCall : import( AssignmentExpression ) diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports.js new file mode 100644 index 0000000000..2d80caa1fe --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +let f = () => import(import(import('./empty_FIXTURE.js'))); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid.js new file mode 100644 index 0000000000..6b2f5c52ae --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +let f = () => import('./script-code-valid.js'); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-nested-imports.js new file mode 100644 index 0000000000..5ef1458d06 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +let f = () => { + import(import(import('./empty_FIXTURE.js'))); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-script-code-valid.js new file mode 100644 index 0000000000..b2775c7885 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +let f = () => { + import('./script-code-valid.js'); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-nested-imports.js new file mode 100644 index 0000000000..810d7774d5 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +async function f() { + await import(import(import('./empty_FIXTURE.js'))); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid.js new file mode 100644 index 0000000000..1d158bc8e3 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +async function f() { + await import('./script-code-valid.js'); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-nested-imports.js new file mode 100644 index 0000000000..346590fed2 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-nested-imports.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +async function f() { + import(import(import('./empty_FIXTURE.js'))); +} + diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports.js new file mode 100644 index 0000000000..5ae4dcc382 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +async function f() { + return await import(import(import('./empty_FIXTURE.js'))); +} + diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid.js new file mode 100644 index 0000000000..59562aa7a5 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +async function f() { + return await import('./script-code-valid.js'); +} + diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-script-code-valid.js new file mode 100644 index 0000000000..c84ea7b9f8 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-script-code-valid.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +async function f() { + import('./script-code-valid.js'); +} + diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-nested-imports.js new file mode 100644 index 0000000000..0f7b975091 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +label: { + import(import(import('./empty_FIXTURE.js'))); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid.js new file mode 100644 index 0000000000..13497b34e7 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: import() can be used in script code (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +label: { + import('./script-code-valid.js'); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-block-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-block-nested-imports.js new file mode 100644 index 0000000000..1966a3f2c3 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-block-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +{ + import(import(import('./empty_FIXTURE.js'))); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-block-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-block-script-code-valid.js new file mode 100644 index 0000000000..5d6695e798 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-block-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: import() can be used in script code (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +{ + import('./script-code-valid.js'); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-nested-imports.js new file mode 100644 index 0000000000..a0cd602d3c --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +do { + import(import(import('./empty_FIXTURE.js'))); +} while (false); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-script-code-valid.js new file mode 100644 index 0000000000..48f077ce61 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: import() can be used in script code (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +do { + import('./script-code-valid.js'); +} while (false); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-nested-imports.js new file mode 100644 index 0000000000..ed3996f100 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +if (false) { + +} else import(import(import('./empty_FIXTURE.js'))); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid.js new file mode 100644 index 0000000000..f89757b044 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: import() can be used in script code (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +if (false) { + +} else import('./script-code-valid.js'); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-else-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-else-nested-imports.js new file mode 100644 index 0000000000..b4a44c9afc --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-else-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +if (false) { + +} else { + import(import(import('./empty_FIXTURE.js'))); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-else-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-else-script-code-valid.js new file mode 100644 index 0000000000..35ea822ce4 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-else-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: import() can be used in script code (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +if (false) { + +} else { + import('./script-code-valid.js'); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js index d6358b05fa..2204048992 100644 --- a/test/language/module-code/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js @@ -5,7 +5,7 @@ description: Calling import('') (nested function syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] info: | ImportCall : import( AssignmentExpression ) diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-function-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-function-nested-imports.js new file mode 100644 index 0000000000..3adda36535 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-function-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +function fn() { + import(import(import('./empty_FIXTURE.js'))); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js index e1238bcfdb..9a223eeb19 100644 --- a/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js @@ -5,7 +5,7 @@ description: Calling import('') (nested function syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] info: | ImportCall : import( AssignmentExpression ) diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-nested-imports.js new file mode 100644 index 0000000000..7fc194e7c2 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +function fn() { + return import(import(import('./empty_FIXTURE.js'))); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-script-code-valid.js new file mode 100644 index 0000000000..c0e3e4bd12 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: import() can be used in script code (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +function fn() { + return import('./script-code-valid.js'); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-function-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-function-script-code-valid.js new file mode 100644 index 0000000000..7ec29607eb --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-function-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: import() can be used in script code (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +function fn() { + import('./script-code-valid.js'); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-nested-imports.js new file mode 100644 index 0000000000..6b384a3597 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-nested-imports.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +if (true) import(import(import('./empty_FIXTURE.js'))); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid.js new file mode 100644 index 0000000000..098450e4bd --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: import() can be used in script code (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +if (true) import('./script-code-valid.js'); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-if-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-if-nested-imports.js new file mode 100644 index 0000000000..8720ddc84e --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-if-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +if (true) { + import(import(import('./empty_FIXTURE.js'))); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-if-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-if-script-code-valid.js new file mode 100644 index 0000000000..60ef420095 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-if-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: import() can be used in script code (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +if (true) { + import('./script-code-valid.js'); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js index 06ed77a9df..8f4e2d62c3 100644 --- a/test/language/module-code/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js @@ -5,7 +5,7 @@ description: Calling import('') (nested while syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] info: | ImportCall : import( AssignmentExpression ) diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-while-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-while-nested-imports.js new file mode 100644 index 0000000000..b14401a2cd --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-while-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ + +let x = 0; +while (!x) { + x++; + import(import(import('./empty_FIXTURE.js'))); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-while-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-while-script-code-valid.js new file mode 100644 index 0000000000..4ad2971bf3 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-while-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: import() can be used in script code (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +let x = 0; +while (!x) { + x++; + import('./script-code-valid.js'); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..9cda787614 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: Calling import('') (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +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]]. + +---*/ + +with ({}) { + import(''); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-with-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/nested-with-nested-imports.js new file mode 100644 index 0000000000..d87919be16 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-with-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +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]]. + +---*/ + +with ({}) { + import(import(import('./empty_FIXTURE.js'))); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-with-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/nested-with-script-code-valid.js new file mode 100644 index 0000000000..1249a3c603 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-with-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: import() can be used in script code (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +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]]. + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +with ({}) { + import('./script-code-valid.js'); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js index ed13876b70..b5e7d2ad24 100644 --- a/test/language/module-code/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js +++ b/test/language/module-code/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js @@ -5,7 +5,7 @@ description: Calling import('') (top level syntax) esid: sec-import-call-runtime-semantics-evaluation features: [dynamic-import] -flags: [generated, module] +flags: [generated] info: | ImportCall : import( AssignmentExpression ) diff --git a/test/language/module-code/dynamic-import/syntax/valid/top-level-nested-imports.js b/test/language/module-code/dynamic-import/syntax/valid/top-level-nested-imports.js new file mode 100644 index 0000000000..fd0db04ead --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/top-level-nested-imports.js @@ -0,0 +1,15 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + +---*/ + +import(import(import('./empty_FIXTURE.js'))); diff --git a/test/language/module-code/dynamic-import/syntax/valid/top-level-script-code-valid.js b/test/language/module-code/dynamic-import/syntax/valid/top-level-script-code-valid.js new file mode 100644 index 0000000000..4509545ac1 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/top-level-script-code-valid.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: import() can be used in script code (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + +---*/ +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + + +import('./script-code-valid.js'); diff --git a/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..db29f50233 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +let f = () => import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..8e9b9dec42 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +let f = () => { + return import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..eab198119b --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +async function f() { + await import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..9f4a45f0e0 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +async function f() { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..97af8e8f98 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +async function f() { + return await import('./dynamic-import-module_FIXTURE.js')['then'](x => x); +} + +f().then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..422750c064 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +{ + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..8b8822323e --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +do { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..95419be6d1 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +if (false) { + +} else { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..860cdb5f19 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +function f() { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..35349af681 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +if (true) import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..63b003c9a4 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +if (true) { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..d5b56b232c --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +let x = 0; +while (!x) { + x++; + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/nested-with-import-then-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-with-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..c8232adb17 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-with-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-with.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +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]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +with ({}) { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-with-import-then-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-with-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..d39cd5cfae --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-with-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-with.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +includes: [fnGlobalObject.js] +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]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +with ({}) { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-with-import-then-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/nested-with-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..18d95fe17a --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-with-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-with.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +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]]. + +---*/ + +with ({}) { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-with-import-then-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-with-import-then-returns-promise.js new file mode 100644 index 0000000000..0b17dd7aeb --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-with-import-then-returns-promise.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-with.template +/*--- +description: Dynamic import() returns a Promise object. (nested with) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async, noStrict] +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]]. + +---*/ + +with ({}) { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..9aae4a39fc --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +label: { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets.js b/test/language/module-code/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..0193cae1fa --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/top-level.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +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]]. + +---*/ + +import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE);