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 new file mode 100644 index 0000000000..622142e849 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-function.template +/*--- +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] +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."; + +async function f() { + import(); +} + + +/* The params region intentionally empty */ 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 new file mode 100644 index 0000000000..f36a527edc --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-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-async-function-await.template +/*--- +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] +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."; + +async function f() { + await import(); +} + +/* The params region intentionally empty */ 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 new file mode 100644 index 0000000000..e4bc337d8c --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +/*--- +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] +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."; + +async function f() { + return await import(); +} + + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..b4a5f064a1 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-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-async-function-await.template +/*--- +description: Calling import('') (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(''); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..e78fe924e2 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js @@ -0,0 +1,28 @@ +// 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-async-function.template +/*--- +description: Calling import('') (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(''); +} + diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..cefd94df23 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js @@ -0,0 +1,28 @@ +// 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-async-function-return-await.template +/*--- +description: Calling import('') (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(''); +} +