diff --git a/src/dynamic-import/catch/nested-async-arrow-fn-await.template b/src/dynamic-import/catch/nested-async-arrow-fn-await.template new file mode 100644 index 0000000000..a97cf1a135 --- /dev/null +++ b/src/dynamic-import/catch/nested-async-arrow-fn-await.template @@ -0,0 +1,32 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-async-arrow-function-await- +name: nested in async arrow function, awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import] +flags: [async] +---*/ + +const f = async () => { + await /*{ import }*/; +} + +f().catch(error => { + + /*{ body }*/ + +}).then($DONE, $DONE); diff --git a/src/dynamic-import/catch/nested-async-arrow-fn-return-await.template b/src/dynamic-import/catch/nested-async-arrow-fn-return-await.template new file mode 100644 index 0000000000..79ed5c69cb --- /dev/null +++ b/src/dynamic-import/catch/nested-async-arrow-fn-return-await.template @@ -0,0 +1,30 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-async-arrow-function-return-await- +name: nested in async arrow function, returned +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import] +flags: [async] +---*/ + +const f = async () => await /*{ import }*/; + +f().catch(error => { + + /*{ body }*/ + +}).then($DONE, $DONE); diff --git a/src/dynamic-import/catch/nested-async-generator-await.template b/src/dynamic-import/catch/nested-async-generator-await.template new file mode 100644 index 0000000000..4bbf79c731 --- /dev/null +++ b/src/dynamic-import/catch/nested-async-generator-await.template @@ -0,0 +1,32 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-async-gen-await- +name: nested in async generator, awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import, async-iteration] +flags: [async] +---*/ + +async function * f() { + await /*{ import }*/; +} + +f().next().catch(error => { + + /*{ body }*/ + +}).then($DONE, $DONE); diff --git a/src/dynamic-import/catch/nested-async-generator-return-await.template b/src/dynamic-import/catch/nested-async-generator-return-await.template new file mode 100644 index 0000000000..cef01a5d30 --- /dev/null +++ b/src/dynamic-import/catch/nested-async-generator-return-await.template @@ -0,0 +1,32 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-async-gen-return-await- +name: nested in async generator, returns awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import, async iteration] +flags: [async] +---*/ + +async function * f() { + return await /*{ import }*/; +} + +f().next().catch(error => { + + /*{ body }*/ + +}).then($DONE, $DONE); diff --git a/src/dynamic-import/default/nested-async-arrow-fn-await.template b/src/dynamic-import/default/nested-async-arrow-fn-await.template new file mode 100644 index 0000000000..9b3b33c2e0 --- /dev/null +++ b/src/dynamic-import/default/nested-async-arrow-fn-await.template @@ -0,0 +1,32 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-async-arrow-function-await- +name: nested in async arrow function, awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import] +flags: [async] +---*/ + +const f = async () => { + await /*{ import }*/.then(imported => { + + /*{ body }*/ + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/default/nested-async-arrow-fn-return-await.template b/src/dynamic-import/default/nested-async-arrow-fn-return-await.template new file mode 100644 index 0000000000..b421e2b178 --- /dev/null +++ b/src/dynamic-import/default/nested-async-arrow-fn-return-await.template @@ -0,0 +1,30 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-async-arrow-function-return-await- +name: nested in async arrow function, returned +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import] +flags: [async] +---*/ + +const f = async () => await /*{ import }*/; + +f().then(imported => { + + /*{ body }*/ + +}).then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/default/nested-async-generator-await.template b/src/dynamic-import/default/nested-async-generator-await.template new file mode 100644 index 0000000000..3027234d77 --- /dev/null +++ b/src/dynamic-import/default/nested-async-generator-await.template @@ -0,0 +1,37 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-async-gen-await- +name: nested in async generator, awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import, async-iteration] +flags: [async] +---*/ + +let callCount = 0; + +async function * f() { + await /*{ import }*/.then(imported => { + + /*{ body }*/ + + callCount++; + }); +} + +f().next().then(() => { + assert.sameValue(callCount, 1); +}).then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/default/nested-async-generator-return-await.template b/src/dynamic-import/default/nested-async-generator-return-await.template new file mode 100644 index 0000000000..9b396fb954 --- /dev/null +++ b/src/dynamic-import/default/nested-async-generator-return-await.template @@ -0,0 +1,32 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-async-gen-return-await- +name: nested in async generator, returns awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import, async iteration] +flags: [async] +---*/ + +async function * f() { + return await /*{ import }*/; +} + +f().next().then(imported => { + + /*{ body }*/ + +}).then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template b/src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template new file mode 100644 index 0000000000..275900761d --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template @@ -0,0 +1,30 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-async-arrow-function-await- +name: nested in async arrow function, awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +(async () => { + await /*{ import }*/ +}); diff --git a/src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template b/src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template new file mode 100644 index 0000000000..88e3b8e56a --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await- +name: nested in async arrow function, returned +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +(async () => await /*{ import }*/) diff --git a/src/dynamic-import/syntax/invalid/nested-async-generator-await.template b/src/dynamic-import/syntax/invalid/nested-async-generator-await.template new file mode 100644 index 0000000000..22d33dc58d --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-async-generator-await.template @@ -0,0 +1,30 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-async-gen-await- +name: nested in async generator, awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import, async-iteration] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function * f() { + await /*{ import }*/ +} diff --git a/src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template b/src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template new file mode 100644 index 0000000000..50e8b9ea9d --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template @@ -0,0 +1,25 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-async-arrow-function-await- +name: nested in async arrow function +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import] +---*/ + +(async () => { + await /*{ import }*/ +}); diff --git a/src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template b/src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template new file mode 100644 index 0000000000..a9c181f469 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-async-arrow-function-return-await- +name: nested in async arrow function, returned +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import] +---*/ + +(async () => await /*{ import }*/); diff --git a/src/dynamic-import/syntax/valid/nested-async-generator-await.template b/src/dynamic-import/syntax/valid/nested-async-generator-await.template new file mode 100644 index 0000000000..38875160fc --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-async-generator-await.template @@ -0,0 +1,25 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-async-gen-await- +name: nested in async generator, awaited +esid: sec-import-call-runtime-semantics-evaluation +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]]. +features: [dynamic-import, async-iteration] +---*/ + +async function * f() { + await /*{ import }*/ +}