From 8b021346a58086e2c7936a09d533c8ad8ee3a02c Mon Sep 17 00:00:00 2001 From: Leo Balter <leonardo.balter@gmail.com> Date: Wed, 3 Oct 2018 13:32:55 -0400 Subject: [PATCH] Small fixups on the templates and create a checklist (WIP) --- ...case => assignment-expr-not-optional.case} | 3 +- .../catch/nested-do-while.template | 2 +- src/dynamic-import/catch/nested-do.template | 35 ------------------- .../catch/nested-labeled-block.template | 33 ----------------- src/dynamic-import/checklist.md | 28 +++++++++++++++ .../nested-async-function-await.template | 4 +-- ...ested-async-function-return-await.template | 10 +++--- .../default/nested-async-function.template | 1 - .../default/nested-do-while.template | 2 +- src/dynamic-import/default/nested-do.template | 35 ------------------- .../default/nested-labeled-block.template | 33 ----------------- .../syntax/invalid/nested-do-while.template | 2 +- .../syntax/invalid/nested-do.template | 35 ------------------- .../syntax/invalid/nested-labeled.template | 33 ----------------- .../syntax/valid/nested-do-while.template | 2 +- .../syntax/valid/nested-do.template | 29 --------------- .../syntax/valid/nested-labeled.template | 28 --------------- 17 files changed, 40 insertions(+), 275 deletions(-) rename src/dynamic-import/{empty-args-early-error.case => assignment-expr-not-optional.case} (88%) delete mode 100644 src/dynamic-import/catch/nested-do.template delete mode 100644 src/dynamic-import/catch/nested-labeled-block.template create mode 100644 src/dynamic-import/checklist.md delete mode 100644 src/dynamic-import/default/nested-do.template delete mode 100644 src/dynamic-import/default/nested-labeled-block.template delete mode 100644 src/dynamic-import/syntax/invalid/nested-do.template delete mode 100644 src/dynamic-import/syntax/invalid/nested-labeled.template delete mode 100644 src/dynamic-import/syntax/valid/nested-do.template delete mode 100644 src/dynamic-import/syntax/valid/nested-labeled.template diff --git a/src/dynamic-import/empty-args-early-error.case b/src/dynamic-import/assignment-expr-not-optional.case similarity index 88% rename from src/dynamic-import/empty-args-early-error.case rename to src/dynamic-import/assignment-expr-not-optional.case index 20f6ffc490..e10f5986a0 100644 --- a/src/dynamic-import/empty-args-early-error.case +++ b/src/dynamic-import/assignment-expr-not-optional.case @@ -6,8 +6,7 @@ desc: It's a SyntaxError if AssignmentExpression is omitted template: syntax/invalid info: | ImportCall : - import() - + import( AssignmentExpression[+In, ?Yield] ) ---*/ //- import import() diff --git a/src/dynamic-import/catch/nested-do-while.template b/src/dynamic-import/catch/nested-do-while.template index 6ef9602ecb..ffda5199d9 100644 --- a/src/dynamic-import/catch/nested-do-while.template +++ b/src/dynamic-import/catch/nested-do-while.template @@ -3,7 +3,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/module-code/dynamic-import/catch/nested-do-while- -name: nested do syntax +name: nested do while syntax esid: sec-import-call-runtime-semantics-evaluation info: | ImportCall : diff --git a/src/dynamic-import/catch/nested-do.template b/src/dynamic-import/catch/nested-do.template deleted file mode 100644 index 17cfd74715..0000000000 --- a/src/dynamic-import/catch/nested-do.template +++ /dev/null @@ -1,35 +0,0 @@ -// 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/catch/nested-do-import-catch- -name: nested do -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] ----*/ - -let x = 0; -do { - x++; - import(/*{ params }*/).catch(error => { - - /*{ body }*/ - - }).then($DONE, $DONE); -} while (!x); diff --git a/src/dynamic-import/catch/nested-labeled-block.template b/src/dynamic-import/catch/nested-labeled-block.template deleted file mode 100644 index bb6e512b0e..0000000000 --- a/src/dynamic-import/catch/nested-labeled-block.template +++ /dev/null @@ -1,33 +0,0 @@ -// 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/catch/nested-labeled-block-import-catch- -name: nested labeled block -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] ----*/ - -{ - import(/*{ params }*/).catch(error => { - - /*{ body }*/ - - }).then($DONE, $DONE); -}; diff --git a/src/dynamic-import/checklist.md b/src/dynamic-import/checklist.md new file mode 100644 index 0000000000..f9f0021989 --- /dev/null +++ b/src/dynamic-import/checklist.md @@ -0,0 +1,28 @@ +# Coverage Checklist for `import()` + +## Default Templates + +_general places it can be found as a CallExpression_ + +- [x] consise body of an ArrowFunction +- [x] function body of an ArrowFunction +- [ ] consise body of an __Async__ ArrowFunction +- [ ] function body of an __Async__ ArrowFunction +- [ ] async function await + +## Cases + +### Syntax + +- [x] assignment expression is not optional +- [x] empty string is a valid assignment expression (not a syntax error) + +## + + + + + + + + diff --git a/src/dynamic-import/default/nested-async-function-await.template b/src/dynamic-import/default/nested-async-function-await.template index ba361b8449..f46b2a1baa 100644 --- a/src/dynamic-import/default/nested-async-function-await.template +++ b/src/dynamic-import/default/nested-async-function-await.template @@ -29,7 +29,7 @@ async function f() { /*{ body }*/ - }).then($DONE, $DONE).catch($DONE); + }); } -f(); +f().then($DONE, $DONE).catch($DONE); 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 80d5ecd51b..cc42ac10a3 100644 --- a/src/dynamic-import/default/nested-async-function-return-await.template +++ b/src/dynamic-import/default/nested-async-function-return-await.template @@ -25,11 +25,11 @@ flags: [async] ---*/ async function f() { - return await import(/*{ params }*/).then(imported => { + return await import(/*{ params }*/); +} - /*{ body }*/ +f().then(imported => { - }).then($DONE, $DONE).catch($DONE); -} + /*{ body }*/ -f(); +}).then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/default/nested-async-function.template b/src/dynamic-import/default/nested-async-function.template index 410b4f2edc..728e8262c0 100644 --- a/src/dynamic-import/default/nested-async-function.template +++ b/src/dynamic-import/default/nested-async-function.template @@ -33,4 +33,3 @@ async function f() { } f(); - diff --git a/src/dynamic-import/default/nested-do-while.template b/src/dynamic-import/default/nested-do-while.template index f0130ad818..63f3ea89a0 100644 --- a/src/dynamic-import/default/nested-do-while.template +++ b/src/dynamic-import/default/nested-do-while.template @@ -3,7 +3,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/module-code/dynamic-import/nested-do-while- -name: nested do syntax +name: nested do while syntax esid: sec-import-call-runtime-semantics-evaluation info: | ImportCall : diff --git a/src/dynamic-import/default/nested-do.template b/src/dynamic-import/default/nested-do.template deleted file mode 100644 index 8bf4daa59c..0000000000 --- a/src/dynamic-import/default/nested-do.template +++ /dev/null @@ -1,35 +0,0 @@ -// 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/nested-do-import-then- -name: nested do -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] ----*/ - -let x = 0; -do { - x++; - import(/*{ params }*/).then(imported => { - - /*{ body }*/ - - }).then($DONE, $DONE).catch($DONE); -} while (!x); diff --git a/src/dynamic-import/default/nested-labeled-block.template b/src/dynamic-import/default/nested-labeled-block.template deleted file mode 100644 index 4ca4b21ee5..0000000000 --- a/src/dynamic-import/default/nested-labeled-block.template +++ /dev/null @@ -1,33 +0,0 @@ -// 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/nested-labeled-block-import-then- -name: nested block -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] ----*/ - -{ - import(/*{ params }*/).then(imported => { - - /*{ body }*/ - - }).then($DONE, $DONE).catch($DONE); -}; diff --git a/src/dynamic-import/syntax/invalid/nested-do-while.template b/src/dynamic-import/syntax/invalid/nested-do-while.template index bf86ff0499..73e567579d 100644 --- a/src/dynamic-import/syntax/invalid/nested-do-while.template +++ b/src/dynamic-import/syntax/invalid/nested-do-while.template @@ -3,7 +3,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/module-code/dynamic-import/syntax/invalid/nested-do-while- -name: nested do syntax +name: nested do while syntax esid: sec-import-call-runtime-semantics-evaluation info: | ImportCall : diff --git a/src/dynamic-import/syntax/invalid/nested-do.template b/src/dynamic-import/syntax/invalid/nested-do.template deleted file mode 100644 index b308638e80..0000000000 --- a/src/dynamic-import/syntax/invalid/nested-do.template +++ /dev/null @@ -1,35 +0,0 @@ -// 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-do- -name: nested do 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]]. - -flags: [module] -features: [dynamic-import] -negative: - phase: parse - type: SyntaxError ----*/ - -throw "Test262: This statement should not be evaluated."; - -let x = 0; -do { - x++; - /*{ import }*/; -} while (!x); diff --git a/src/dynamic-import/syntax/invalid/nested-labeled.template b/src/dynamic-import/syntax/invalid/nested-labeled.template deleted file mode 100644 index 83e13bec5e..0000000000 --- a/src/dynamic-import/syntax/invalid/nested-labeled.template +++ /dev/null @@ -1,33 +0,0 @@ -// 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-labeled-block- -name: nested block 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]]. - -flags: [module] -features: [dynamic-import] -negative: - phase: parse - type: SyntaxError ----*/ - -throw "Test262: This statement should not be evaluated."; - -{ - /*{ import }*/; -}; diff --git a/src/dynamic-import/syntax/valid/nested-do-while.template b/src/dynamic-import/syntax/valid/nested-do-while.template index 1b5a391c02..a269d99144 100644 --- a/src/dynamic-import/syntax/valid/nested-do-while.template +++ b/src/dynamic-import/syntax/valid/nested-do-while.template @@ -3,7 +3,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- path: language/module-code/dynamic-import/syntax/valid/nested-do-while- -name: nested do syntax +name: nested do while syntax esid: sec-import-call-runtime-semantics-evaluation info: | ImportCall : diff --git a/src/dynamic-import/syntax/valid/nested-do.template b/src/dynamic-import/syntax/valid/nested-do.template deleted file mode 100644 index 8545c440b9..0000000000 --- a/src/dynamic-import/syntax/valid/nested-do.template +++ /dev/null @@ -1,29 +0,0 @@ -// 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-do- -name: nested do 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] ----*/ - -let x = 0; -do { - x++; - /*{ import }*/; -} while (!x); diff --git a/src/dynamic-import/syntax/valid/nested-labeled.template b/src/dynamic-import/syntax/valid/nested-labeled.template deleted file mode 100644 index 31b65b5627..0000000000 --- a/src/dynamic-import/syntax/valid/nested-labeled.template +++ /dev/null @@ -1,28 +0,0 @@ -// 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-labeled-block- -name: nested block 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] ----*/ - -{ - /*{ import }*/; -}; -- GitLab