From 8e28caa214f2d9d6fa46760b8e7b4d5d9676bfc3 Mon Sep 17 00:00:00 2001 From: Leo Balter <leonardo.balter@gmail.com> Date: Fri, 5 Oct 2018 12:14:12 -0400 Subject: [PATCH] Add more coverage to dynamic import - Add cases for invalid syntax - Add valid cases - nested imports - add non existent file case - Fix cases and templates to use a full importcall expr token - add case for call expression position - remove unnecessary module flag from templates - Add templates for nested with --- .../catch/nested-arrow.template | 2 +- .../nested-async-function-await.template | 2 +- ...ested-async-function-return-await.template | 2 +- .../catch/nested-async-function.template | 2 +- .../catch/nested-block-labeled.template | 2 +- .../catch/nested-block.template | 2 +- .../catch/nested-do-while.template | 2 +- src/dynamic-import/catch/nested-else.template | 2 +- .../catch/nested-function.template | 2 +- src/dynamic-import/catch/nested-if.template | 2 +- .../catch/nested-while.template | 2 +- src/dynamic-import/catch/nested-with.template | 31 ++++++++++++++++++ src/dynamic-import/catch/top-level.template | 2 +- .../default/nested-arrow-assign-expr.template | 2 +- .../default/nested-arrow.template | 2 +- .../nested-async-function-await.template | 2 +- ...ested-async-function-return-await.template | 2 +- .../default/nested-async-function.template | 2 +- .../default/nested-block-labeled.template | 2 +- .../default/nested-block.template | 2 +- .../default/nested-do-while.template | 2 +- .../default/nested-else.template | 2 +- .../default/nested-function.template | 2 +- .../default/nested-if-braceless.template | 2 +- src/dynamic-import/default/nested-if.template | 2 +- .../default/nested-while.template | 2 +- .../default/nested-with.template | 30 +++++++++++++++++ src/dynamic-import/default/top-level.template | 2 +- .../eval-gtbndng-indirect-update-dflt.case | 4 +-- .../eval-gtbndng-indirect-update.case | 4 +-- .../eval-rqstd-abrupt-typeerror.case | 4 +-- .../eval-rqstd-abrupt-urierror.case | 4 +-- src/dynamic-import/file-does-not-exist.case | 16 ++++++++++ .../instn-iee-err-ambiguous-import.case | 4 +-- .../instn-iee-err-circular.case | 4 +-- .../is-call-expression-square-brackets.case | 11 +++++++ src/dynamic-import/nested-imports.case | 9 ++++++ src/dynamic-import/not-extensible-args.case | 16 ++++++++++ .../not-extensible-no-trailing-comma.case | 16 ++++++++++ src/dynamic-import/returns-promise.case | 4 +-- src/dynamic-import/script-code-valid.case | 14 ++++++++ ...ested-arrow-assignment-expression.template | 2 -- .../syntax/invalid/nested-arrow.template | 2 -- .../nested-async-function-await.template | 2 -- ...ested-async-function-return-await.template | 2 -- .../invalid/nested-async-function.template | 2 -- .../invalid/nested-block-labeled.template | 2 -- .../syntax/invalid/nested-block.template | 2 -- .../syntax/invalid/nested-do-while.template | 2 -- .../invalid/nested-else-braceless.template | 2 -- .../syntax/invalid/nested-else.template | 2 -- .../invalid/nested-function-return.template | 2 -- .../syntax/invalid/nested-function.template | 2 -- .../invalid/nested-if-braceless.template | 2 -- .../syntax/invalid/nested-if.template | 2 -- .../syntax/invalid/nested-while.template | 2 -- .../syntax/invalid/nested-with.template | 32 +++++++++++++++++++ .../syntax/invalid/top-level.template | 2 -- ...ested-arrow-assignment-expression.template | 2 -- .../syntax/valid/nested-arrow.template | 2 -- .../nested-async-function-await.template | 2 -- ...ested-async-function-return-await.template | 2 -- .../valid/nested-async-function.template | 2 -- .../valid/nested-block-labeled.template | 2 -- .../syntax/valid/nested-block.template | 2 -- .../syntax/valid/nested-do-while.template | 2 -- .../valid/nested-else-braceless.template | 2 -- .../syntax/valid/nested-else.template | 2 -- .../valid/nested-function-return.template | 2 -- .../syntax/valid/nested-function.template | 2 -- .../syntax/valid/nested-if-braceless.template | 2 -- .../syntax/valid/nested-if.template | 2 -- .../syntax/valid/nested-while.template | 2 -- .../syntax/valid/nested-with.template | 27 ++++++++++++++++ .../syntax/valid/top-level.template | 2 -- .../syntax/valid/empty_FIXTURE.js | 0 76 files changed, 242 insertions(+), 104 deletions(-) create mode 100644 src/dynamic-import/catch/nested-with.template create mode 100644 src/dynamic-import/default/nested-with.template create mode 100644 src/dynamic-import/file-does-not-exist.case create mode 100644 src/dynamic-import/is-call-expression-square-brackets.case create mode 100644 src/dynamic-import/nested-imports.case create mode 100644 src/dynamic-import/not-extensible-args.case create mode 100644 src/dynamic-import/not-extensible-no-trailing-comma.case create mode 100644 src/dynamic-import/script-code-valid.case create mode 100644 src/dynamic-import/syntax/invalid/nested-with.template create mode 100644 src/dynamic-import/syntax/valid/nested-with.template create mode 100644 test/language/module-code/dynamic-import/syntax/valid/empty_FIXTURE.js diff --git a/src/dynamic-import/catch/nested-arrow.template b/src/dynamic-import/catch/nested-arrow.template index 96aa28b103..957927a367 100644 --- a/src/dynamic-import/catch/nested-arrow.template +++ b/src/dynamic-import/catch/nested-arrow.template @@ -25,7 +25,7 @@ flags: [async] ---*/ let f = () => { - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-async-function-await.template b/src/dynamic-import/catch/nested-async-function-await.template index fb62d11290..99d2957b13 100644 --- a/src/dynamic-import/catch/nested-async-function-await.template +++ b/src/dynamic-import/catch/nested-async-function-await.template @@ -25,7 +25,7 @@ flags: [async] ---*/ async function f() { - await import(/*{ params }*/).catch(error => { + await /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-async-function-return-await.template b/src/dynamic-import/catch/nested-async-function-return-await.template index 75b81e0dc2..71e3010746 100644 --- a/src/dynamic-import/catch/nested-async-function-return-await.template +++ b/src/dynamic-import/catch/nested-async-function-return-await.template @@ -25,7 +25,7 @@ flags: [async] ---*/ async function f() { - return await import(/*{ params }*/).catch(error => { + return await /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-async-function.template b/src/dynamic-import/catch/nested-async-function.template index 3a2ae55283..257ac79e12 100644 --- a/src/dynamic-import/catch/nested-async-function.template +++ b/src/dynamic-import/catch/nested-async-function.template @@ -25,7 +25,7 @@ flags: [async] ---*/ async function f() { - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-block-labeled.template b/src/dynamic-import/catch/nested-block-labeled.template index ad857641b1..2d1503dd64 100644 --- a/src/dynamic-import/catch/nested-block-labeled.template +++ b/src/dynamic-import/catch/nested-block-labeled.template @@ -25,7 +25,7 @@ flags: [async] ---*/ label: { - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-block.template b/src/dynamic-import/catch/nested-block.template index 47254e57fe..d17585b1a9 100644 --- a/src/dynamic-import/catch/nested-block.template +++ b/src/dynamic-import/catch/nested-block.template @@ -25,7 +25,7 @@ flags: [async] ---*/ { - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-do-while.template b/src/dynamic-import/catch/nested-do-while.template index ffda5199d9..644d834481 100644 --- a/src/dynamic-import/catch/nested-do-while.template +++ b/src/dynamic-import/catch/nested-do-while.template @@ -25,7 +25,7 @@ flags: [async] ---*/ do { - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-else.template b/src/dynamic-import/catch/nested-else.template index cc36621ada..0b994c52f6 100644 --- a/src/dynamic-import/catch/nested-else.template +++ b/src/dynamic-import/catch/nested-else.template @@ -27,7 +27,7 @@ flags: [async] if (false) { } else { - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-function.template b/src/dynamic-import/catch/nested-function.template index febdb2d639..311ac33b36 100644 --- a/src/dynamic-import/catch/nested-function.template +++ b/src/dynamic-import/catch/nested-function.template @@ -25,7 +25,7 @@ flags: [async] ---*/ function f() { - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-if.template b/src/dynamic-import/catch/nested-if.template index 78b4f19687..60d639fe21 100644 --- a/src/dynamic-import/catch/nested-if.template +++ b/src/dynamic-import/catch/nested-if.template @@ -25,7 +25,7 @@ flags: [async] ---*/ if (true) { - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-while.template b/src/dynamic-import/catch/nested-while.template index 341572885a..c2dcdae201 100644 --- a/src/dynamic-import/catch/nested-while.template +++ b/src/dynamic-import/catch/nested-while.template @@ -27,7 +27,7 @@ flags: [async] let x = 0; while (!x) { x++; - import(/*{ params }*/).catch(error => { + /*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/catch/nested-with.template b/src/dynamic-import/catch/nested-with.template new file mode 100644 index 0000000000..e88b46e674 --- /dev/null +++ b/src/dynamic-import/catch/nested-with.template @@ -0,0 +1,31 @@ +// 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-with-import-catch- +name: nested with +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, noStrict] +---*/ + +with ({}) { + /*{ import }*/.catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +} + \ No newline at end of file diff --git a/src/dynamic-import/catch/top-level.template b/src/dynamic-import/catch/top-level.template index ee26cf4d7b..099dd891b7 100644 --- a/src/dynamic-import/catch/top-level.template +++ b/src/dynamic-import/catch/top-level.template @@ -24,7 +24,7 @@ features: [dynamic-import] flags: [async] ---*/ -import(/*{ params }*/).catch(error => { +/*{ import }*/.catch(error => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-arrow-assign-expr.template b/src/dynamic-import/default/nested-arrow-assign-expr.template index 7d6d90aa8e..1692b8e81b 100644 --- a/src/dynamic-import/default/nested-arrow-assign-expr.template +++ b/src/dynamic-import/default/nested-arrow-assign-expr.template @@ -24,7 +24,7 @@ features: [dynamic-import] flags: [async] ---*/ -let f = () => import(/*{ params }*/).then(imported => { +let f = () => /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-arrow.template b/src/dynamic-import/default/nested-arrow.template index 061526cac5..d010c20751 100644 --- a/src/dynamic-import/default/nested-arrow.template +++ b/src/dynamic-import/default/nested-arrow.template @@ -25,7 +25,7 @@ flags: [async] ---*/ let f = () => { - return import(/*{ params }*/).then(imported => { + return /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-async-function-await.template b/src/dynamic-import/default/nested-async-function-await.template index 7e561c6ae1..6847734545 100644 --- a/src/dynamic-import/default/nested-async-function-await.template +++ b/src/dynamic-import/default/nested-async-function-await.template @@ -25,7 +25,7 @@ flags: [async] ---*/ async function f() { - await import(/*{ params }*/).then(imported => { + await /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-async-function-return-await.template b/src/dynamic-import/default/nested-async-function-return-await.template index 55e85c71ee..79158d65d7 100644 --- a/src/dynamic-import/default/nested-async-function-return-await.template +++ b/src/dynamic-import/default/nested-async-function-return-await.template @@ -25,7 +25,7 @@ flags: [async] ---*/ async function f() { - return await import(/*{ params }*/); + return await /*{ import }*/; } f().then(imported => { diff --git a/src/dynamic-import/default/nested-async-function.template b/src/dynamic-import/default/nested-async-function.template index f83da4142f..cfc641bb2a 100644 --- a/src/dynamic-import/default/nested-async-function.template +++ b/src/dynamic-import/default/nested-async-function.template @@ -25,7 +25,7 @@ flags: [async] ---*/ async function f() { - import(/*{ params }*/).then(imported => { + /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-block-labeled.template b/src/dynamic-import/default/nested-block-labeled.template index 71e8125919..58c57cf27f 100644 --- a/src/dynamic-import/default/nested-block-labeled.template +++ b/src/dynamic-import/default/nested-block-labeled.template @@ -25,7 +25,7 @@ flags: [async] ---*/ label: { - import(/*{ params }*/).then(imported => { + /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-block.template b/src/dynamic-import/default/nested-block.template index ebfce21e35..5ca6ac488b 100644 --- a/src/dynamic-import/default/nested-block.template +++ b/src/dynamic-import/default/nested-block.template @@ -25,7 +25,7 @@ flags: [async] ---*/ { - import(/*{ params }*/).then(imported => { + /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-do-while.template b/src/dynamic-import/default/nested-do-while.template index 902b3236e9..204da1c37f 100644 --- a/src/dynamic-import/default/nested-do-while.template +++ b/src/dynamic-import/default/nested-do-while.template @@ -25,7 +25,7 @@ flags: [async] ---*/ do { - import(/*{ params }*/).then(imported => { + /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-else.template b/src/dynamic-import/default/nested-else.template index b26a128e16..1cb4be08f6 100644 --- a/src/dynamic-import/default/nested-else.template +++ b/src/dynamic-import/default/nested-else.template @@ -27,7 +27,7 @@ flags: [async] if (false) { } else { - import(/*{ params }*/).then(imported => { + /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-function.template b/src/dynamic-import/default/nested-function.template index 48e60f4bfc..b99372ff81 100644 --- a/src/dynamic-import/default/nested-function.template +++ b/src/dynamic-import/default/nested-function.template @@ -25,7 +25,7 @@ flags: [async] ---*/ function f() { - import(/*{ params }*/).then(imported => { + /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-if-braceless.template b/src/dynamic-import/default/nested-if-braceless.template index 907dd35e9e..2374e28c29 100644 --- a/src/dynamic-import/default/nested-if-braceless.template +++ b/src/dynamic-import/default/nested-if-braceless.template @@ -24,7 +24,7 @@ features: [dynamic-import] flags: [async] ---*/ -if (true) import(/*{ params }*/).then(imported => { +if (true) /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-if.template b/src/dynamic-import/default/nested-if.template index c8fb0c83e6..9c07bf8514 100644 --- a/src/dynamic-import/default/nested-if.template +++ b/src/dynamic-import/default/nested-if.template @@ -25,7 +25,7 @@ flags: [async] ---*/ if (true) { - import(/*{ params }*/).then(imported => { + /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-while.template b/src/dynamic-import/default/nested-while.template index fa2a103a2f..97c400d0f0 100644 --- a/src/dynamic-import/default/nested-while.template +++ b/src/dynamic-import/default/nested-while.template @@ -27,7 +27,7 @@ flags: [async] let x = 0; while (!x) { x++; - import(/*{ params }*/).then(imported => { + /*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/default/nested-with.template b/src/dynamic-import/default/nested-with.template new file mode 100644 index 0000000000..0520321497 --- /dev/null +++ b/src/dynamic-import/default/nested-with.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-with-import-then- +name: nested with +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, noStrict] +---*/ + +with ({}) { + /*{ import }*/.then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/src/dynamic-import/default/top-level.template b/src/dynamic-import/default/top-level.template index 9982059a09..bd46db1fcf 100644 --- a/src/dynamic-import/default/top-level.template +++ b/src/dynamic-import/default/top-level.template @@ -24,7 +24,7 @@ features: [dynamic-import] flags: [async] ---*/ -import(/*{ params }*/).then(imported => { +/*{ import }*/.then(imported => { /*{ body }*/ diff --git a/src/dynamic-import/eval-gtbndng-indirect-update-dflt.case b/src/dynamic-import/eval-gtbndng-indirect-update-dflt.case index ae7310a5b0..4c0bd0aa56 100644 --- a/src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +++ b/src/dynamic-import/eval-gtbndng-indirect-update-dflt.case @@ -20,8 +20,8 @@ info: | template: default ---*/ -//- params -'./eval-gtbndng-indirect-update-dflt_FIXTURE.js' +//- import +import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js') //- body assert.sameValue(imported.default(), 1); assert.sameValue(imported.default, 2); diff --git a/src/dynamic-import/eval-gtbndng-indirect-update.case b/src/dynamic-import/eval-gtbndng-indirect-update.case index 030b532914..3072affae0 100644 --- a/src/dynamic-import/eval-gtbndng-indirect-update.case +++ b/src/dynamic-import/eval-gtbndng-indirect-update.case @@ -21,8 +21,8 @@ includes: [fnGlobalObject.js] template: default ---*/ -//- params -'./eval-gtbndng-indirect-update_FIXTURE.js' +//- import +import('./eval-gtbndng-indirect-update_FIXTURE.js') //- body assert.sameValue(imported.x, 1); diff --git a/src/dynamic-import/eval-rqstd-abrupt-typeerror.case b/src/dynamic-import/eval-rqstd-abrupt-typeerror.case index 371b0d6800..f5dddeba9d 100644 --- a/src/dynamic-import/eval-rqstd-abrupt-typeerror.case +++ b/src/dynamic-import/eval-rqstd-abrupt-typeerror.case @@ -14,7 +14,7 @@ info: | template: catch ---*/ -//- params -'./eval-rqstd-abrupt-err-type_FIXTURE.js' +//- import +import('./eval-rqstd-abrupt-err-type_FIXTURE.js') //- body assert.sameValue(error.name, 'TypeError'); diff --git a/src/dynamic-import/eval-rqstd-abrupt-urierror.case b/src/dynamic-import/eval-rqstd-abrupt-urierror.case index bff657b556..c8ed90897f 100644 --- a/src/dynamic-import/eval-rqstd-abrupt-urierror.case +++ b/src/dynamic-import/eval-rqstd-abrupt-urierror.case @@ -14,7 +14,7 @@ info: | template: catch ---*/ -//- params -'./eval-rqstd-abrupt-err-uri_FIXTURE.js' +//- import +import('./eval-rqstd-abrupt-err-uri_FIXTURE.js') //- body assert.sameValue(error.name, 'URIError'); diff --git a/src/dynamic-import/file-does-not-exist.case b/src/dynamic-import/file-does-not-exist.case new file mode 100644 index 0000000000..dd869ffc06 --- /dev/null +++ b/src/dynamic-import/file-does-not-exist.case @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Non existent file can't resolve to a Script or Module Record +esid: sec-hostresolveimportedmodule +info: | + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. +template: catch +---*/ + +//- import +import('./THIS_FILE_DOES_NOT_EXIST.js') +//- body +assert.notSameValue(typeof error, 'undefined'); diff --git a/src/dynamic-import/instn-iee-err-ambiguous-import.case b/src/dynamic-import/instn-iee-err-ambiguous-import.case index 184744db3f..74de078676 100644 --- a/src/dynamic-import/instn-iee-err-ambiguous-import.case +++ b/src/dynamic-import/instn-iee-err-ambiguous-import.case @@ -34,7 +34,7 @@ info: | template: catch ---*/ -//- params -'./instn-iee-err-ambiguous-export_FIXTURE.js' +//- import +import('./instn-iee-err-ambiguous-export_FIXTURE.js') //- body assert.sameValue(error.name, 'SyntaxError'); diff --git a/src/dynamic-import/instn-iee-err-circular.case b/src/dynamic-import/instn-iee-err-circular.case index 6b34395f17..a1fd29ef79 100644 --- a/src/dynamic-import/instn-iee-err-circular.case +++ b/src/dynamic-import/instn-iee-err-circular.case @@ -23,7 +23,7 @@ info: | template: catch ---*/ -//- params -'./instn-iee-err-circular-1_FIXTURE.js' +//- import +import('./instn-iee-err-circular-1_FIXTURE.js') //- body assert.sameValue(error.name, 'SyntaxError'); diff --git a/src/dynamic-import/is-call-expression-square-brackets.case b/src/dynamic-import/is-call-expression-square-brackets.case new file mode 100644 index 0000000000..9038263ffc --- /dev/null +++ b/src/dynamic-import/is-call-expression-square-brackets.case @@ -0,0 +1,11 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: ImportCall is a CallExpression, it can be followed by square brackets +template: default +---*/ + +//- import +import('./dynamic-import-module_FIXTURE.js')['then'](x => x) +//- body +assert.sameValue(imported.x, 1); diff --git a/src/dynamic-import/nested-imports.case b/src/dynamic-import/nested-imports.case new file mode 100644 index 0000000000..db7b368391 --- /dev/null +++ b/src/dynamic-import/nested-imports.case @@ -0,0 +1,9 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: ImportCall is a CallExpression can be nested in other import calls +template: syntax/valid +---*/ + +//- import +import(import(import('./empty_FIXTURE.js'))) diff --git a/src/dynamic-import/not-extensible-args.case b/src/dynamic-import/not-extensible-args.case new file mode 100644 index 0000000000..655444498a --- /dev/null +++ b/src/dynamic-import/not-extensible-args.case @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: ImportCall is not extensible - no arguments list +template: syntax/invalid +info: | + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +//- import +import('', '') diff --git a/src/dynamic-import/not-extensible-no-trailing-comma.case b/src/dynamic-import/not-extensible-no-trailing-comma.case new file mode 100644 index 0000000000..3d97a3b9d9 --- /dev/null +++ b/src/dynamic-import/not-extensible-no-trailing-comma.case @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: ImportCall is not extensible - trailing comma +template: syntax/invalid +info: | + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +//- import +import('',) diff --git a/src/dynamic-import/returns-promise.case b/src/dynamic-import/returns-promise.case index 0160b0704d..e03f674d31 100644 --- a/src/dynamic-import/returns-promise.case +++ b/src/dynamic-import/returns-promise.case @@ -6,7 +6,7 @@ desc: Dynamic import() returns a Promise object. template: default ---*/ -//- params -'./dynamic-import-module_FIXTURE.js' +//- import +import('./dynamic-import-module_FIXTURE.js') //- body assert.sameValue(imported.x, 1); diff --git a/src/dynamic-import/script-code-valid.case b/src/dynamic-import/script-code-valid.case new file mode 100644 index 0000000000..92ba37cbff --- /dev/null +++ b/src/dynamic-import/script-code-valid.case @@ -0,0 +1,14 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: import() can be used in script code +template: syntax/valid +---*/ + +//- setup +// It is a Syntax Error if ModuleItemList Contains NewTarget +// This is still valid in script code +new.target; + +//- import +import('./script-code-valid.js') diff --git a/src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template b/src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template index 98ee16f6a1..639ec1a23c 100644 --- a/src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template +++ b/src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-arrow.template b/src/dynamic-import/syntax/invalid/nested-arrow.template index 5a50736bae..f92d615bc0 100644 --- a/src/dynamic-import/syntax/invalid/nested-arrow.template +++ b/src/dynamic-import/syntax/invalid/nested-arrow.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-async-function-await.template b/src/dynamic-import/syntax/invalid/nested-async-function-await.template index 4d433c2b1f..74087382e1 100644 --- a/src/dynamic-import/syntax/invalid/nested-async-function-await.template +++ b/src/dynamic-import/syntax/invalid/nested-async-function-await.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-async-function-return-await.template b/src/dynamic-import/syntax/invalid/nested-async-function-return-await.template index 34c7097634..661c80920f 100644 --- a/src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +++ b/src/dynamic-import/syntax/invalid/nested-async-function-return-await.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-async-function.template b/src/dynamic-import/syntax/invalid/nested-async-function.template index d84cc931ed..5cb6c074be 100644 --- a/src/dynamic-import/syntax/invalid/nested-async-function.template +++ b/src/dynamic-import/syntax/invalid/nested-async-function.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-block-labeled.template b/src/dynamic-import/syntax/invalid/nested-block-labeled.template index 2c37acf008..e1c86d209f 100644 --- a/src/dynamic-import/syntax/invalid/nested-block-labeled.template +++ b/src/dynamic-import/syntax/invalid/nested-block-labeled.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-block.template b/src/dynamic-import/syntax/invalid/nested-block.template index d569536bb9..9f8a6e3b6c 100644 --- a/src/dynamic-import/syntax/invalid/nested-block.template +++ b/src/dynamic-import/syntax/invalid/nested-block.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-do-while.template b/src/dynamic-import/syntax/invalid/nested-do-while.template index 73e567579d..9d8c705c2e 100644 --- a/src/dynamic-import/syntax/invalid/nested-do-while.template +++ b/src/dynamic-import/syntax/invalid/nested-do-while.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-else-braceless.template b/src/dynamic-import/syntax/invalid/nested-else-braceless.template index 61989c9b59..2a9997ad46 100644 --- a/src/dynamic-import/syntax/invalid/nested-else-braceless.template +++ b/src/dynamic-import/syntax/invalid/nested-else-braceless.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-else.template b/src/dynamic-import/syntax/invalid/nested-else.template index 14017d2c5e..2042c31662 100644 --- a/src/dynamic-import/syntax/invalid/nested-else.template +++ b/src/dynamic-import/syntax/invalid/nested-else.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-function-return.template b/src/dynamic-import/syntax/invalid/nested-function-return.template index 1590943656..875e9131fb 100644 --- a/src/dynamic-import/syntax/invalid/nested-function-return.template +++ b/src/dynamic-import/syntax/invalid/nested-function-return.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-function.template b/src/dynamic-import/syntax/invalid/nested-function.template index e81ddf9c9a..df99408228 100644 --- a/src/dynamic-import/syntax/invalid/nested-function.template +++ b/src/dynamic-import/syntax/invalid/nested-function.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-if-braceless.template b/src/dynamic-import/syntax/invalid/nested-if-braceless.template index 7f51cb411b..820a1161ca 100644 --- a/src/dynamic-import/syntax/invalid/nested-if-braceless.template +++ b/src/dynamic-import/syntax/invalid/nested-if-braceless.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-if.template b/src/dynamic-import/syntax/invalid/nested-if.template index 830eab471b..202e3517ef 100644 --- a/src/dynamic-import/syntax/invalid/nested-if.template +++ b/src/dynamic-import/syntax/invalid/nested-if.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-while.template b/src/dynamic-import/syntax/invalid/nested-while.template index daeb7b4a44..a2c27248ef 100644 --- a/src/dynamic-import/syntax/invalid/nested-while.template +++ b/src/dynamic-import/syntax/invalid/nested-while.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/invalid/nested-with.template b/src/dynamic-import/syntax/invalid/nested-with.template new file mode 100644 index 0000000000..225b9b44ba --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-with.template @@ -0,0 +1,32 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. 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-with- +name: nested with syntax +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: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +with ({}) { + /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/invalid/top-level.template b/src/dynamic-import/syntax/invalid/top-level.template index c85c6393eb..31fb845cb3 100644 --- a/src/dynamic-import/syntax/invalid/top-level.template +++ b/src/dynamic-import/syntax/invalid/top-level.template @@ -8,8 +8,6 @@ esid: sec-import-call-runtime-semantics-evaluation info: | ImportCall : import( AssignmentExpression ) - -flags: [module] features: [dynamic-import] negative: phase: parse diff --git a/src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template b/src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template index 1e3b61b9d5..5b06b5c8a1 100644 --- a/src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +++ b/src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-arrow.template b/src/dynamic-import/syntax/valid/nested-arrow.template index f906eaa4dd..491052c157 100644 --- a/src/dynamic-import/syntax/valid/nested-arrow.template +++ b/src/dynamic-import/syntax/valid/nested-arrow.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-async-function-await.template b/src/dynamic-import/syntax/valid/nested-async-function-await.template index 0480ab68fd..1072d23a06 100644 --- a/src/dynamic-import/syntax/valid/nested-async-function-await.template +++ b/src/dynamic-import/syntax/valid/nested-async-function-await.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-async-function-return-await.template b/src/dynamic-import/syntax/valid/nested-async-function-return-await.template index d9063ca78f..6ae8c305b5 100644 --- a/src/dynamic-import/syntax/valid/nested-async-function-return-await.template +++ b/src/dynamic-import/syntax/valid/nested-async-function-return-await.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-async-function.template b/src/dynamic-import/syntax/valid/nested-async-function.template index f358c16314..cec45979ba 100644 --- a/src/dynamic-import/syntax/valid/nested-async-function.template +++ b/src/dynamic-import/syntax/valid/nested-async-function.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-block-labeled.template b/src/dynamic-import/syntax/valid/nested-block-labeled.template index 970edc5fb7..cb85b8bcd3 100644 --- a/src/dynamic-import/syntax/valid/nested-block-labeled.template +++ b/src/dynamic-import/syntax/valid/nested-block-labeled.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-block.template b/src/dynamic-import/syntax/valid/nested-block.template index 38e2356516..18d711ee76 100644 --- a/src/dynamic-import/syntax/valid/nested-block.template +++ b/src/dynamic-import/syntax/valid/nested-block.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-do-while.template b/src/dynamic-import/syntax/valid/nested-do-while.template index a269d99144..b2c71cd73f 100644 --- a/src/dynamic-import/syntax/valid/nested-do-while.template +++ b/src/dynamic-import/syntax/valid/nested-do-while.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-else-braceless.template b/src/dynamic-import/syntax/valid/nested-else-braceless.template index 86948d9302..f031a07c5c 100644 --- a/src/dynamic-import/syntax/valid/nested-else-braceless.template +++ b/src/dynamic-import/syntax/valid/nested-else-braceless.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-else.template b/src/dynamic-import/syntax/valid/nested-else.template index 1f93708b69..81c10cdcfa 100644 --- a/src/dynamic-import/syntax/valid/nested-else.template +++ b/src/dynamic-import/syntax/valid/nested-else.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-function-return.template b/src/dynamic-import/syntax/valid/nested-function-return.template index db04a04757..619d369cb1 100644 --- a/src/dynamic-import/syntax/valid/nested-function-return.template +++ b/src/dynamic-import/syntax/valid/nested-function-return.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-function.template b/src/dynamic-import/syntax/valid/nested-function.template index 8fd7eff00d..25c730bba6 100644 --- a/src/dynamic-import/syntax/valid/nested-function.template +++ b/src/dynamic-import/syntax/valid/nested-function.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-if-braceless.template b/src/dynamic-import/syntax/valid/nested-if-braceless.template index 0cd924889f..a620bad7e3 100644 --- a/src/dynamic-import/syntax/valid/nested-if-braceless.template +++ b/src/dynamic-import/syntax/valid/nested-if-braceless.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-if.template b/src/dynamic-import/syntax/valid/nested-if.template index 5cebc7a628..a8add970de 100644 --- a/src/dynamic-import/syntax/valid/nested-if.template +++ b/src/dynamic-import/syntax/valid/nested-if.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - - features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-while.template b/src/dynamic-import/syntax/valid/nested-while.template index ac2cd12bf1..d1cffee349 100644 --- a/src/dynamic-import/syntax/valid/nested-while.template +++ b/src/dynamic-import/syntax/valid/nested-while.template @@ -18,8 +18,6 @@ info: | 7. IfAbruptRejectPromise(specifierString, promiseCapability). 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 9. Return promiseCapability.[[Promise]]. - -flags: [module] features: [dynamic-import] ---*/ diff --git a/src/dynamic-import/syntax/valid/nested-with.template b/src/dynamic-import/syntax/valid/nested-with.template new file mode 100644 index 0000000000..8ee2d5a61c --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-with.template @@ -0,0 +1,27 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. 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-with- +name: nested with syntax +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: [noStrict] +---*/ + +with ({}) { + /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/valid/top-level.template b/src/dynamic-import/syntax/valid/top-level.template index 33387103d8..ba421abeec 100644 --- a/src/dynamic-import/syntax/valid/top-level.template +++ b/src/dynamic-import/syntax/valid/top-level.template @@ -8,8 +8,6 @@ esid: sec-import-call-runtime-semantics-evaluation info: | ImportCall : import( AssignmentExpression ) - -flags: [module] features: [dynamic-import] ---*/ diff --git a/test/language/module-code/dynamic-import/syntax/valid/empty_FIXTURE.js b/test/language/module-code/dynamic-import/syntax/valid/empty_FIXTURE.js new file mode 100644 index 0000000000..e69de29bb2 -- GitLab