Skip to content
Snippets Groups Projects
Commit 8b021346 authored by Leo Balter's avatar Leo Balter Committed by Rick Waldron
Browse files

Small fixups on the templates and create a checklist (WIP)

parent 24d1a780
No related branches found
No related tags found
No related merge requests found
Showing
with 40 additions and 275 deletions
...@@ -6,8 +6,7 @@ desc: It's a SyntaxError if AssignmentExpression is omitted ...@@ -6,8 +6,7 @@ desc: It's a SyntaxError if AssignmentExpression is omitted
template: syntax/invalid template: syntax/invalid
info: | info: |
ImportCall : ImportCall :
import() import( AssignmentExpression[+In, ?Yield] )
---*/ ---*/
//- import //- import
import() import()
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
path: language/module-code/dynamic-import/catch/nested-do-while- 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 esid: sec-import-call-runtime-semantics-evaluation
info: | info: |
ImportCall : ImportCall :
......
// 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);
// 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);
};
# 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)
##
...@@ -29,7 +29,7 @@ async function f() { ...@@ -29,7 +29,7 @@ async function f() {
/*{ body }*/ /*{ body }*/
}).then($DONE, $DONE).catch($DONE); });
} }
f(); f().then($DONE, $DONE).catch($DONE);
...@@ -25,11 +25,11 @@ flags: [async] ...@@ -25,11 +25,11 @@ flags: [async]
---*/ ---*/
async function f() { 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);
...@@ -33,4 +33,3 @@ async function f() { ...@@ -33,4 +33,3 @@ async function f() {
} }
f(); f();
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
path: language/module-code/dynamic-import/nested-do-while- 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 esid: sec-import-call-runtime-semantics-evaluation
info: | info: |
ImportCall : ImportCall :
......
// 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);
// 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);
};
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
path: language/module-code/dynamic-import/syntax/invalid/nested-do-while- 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 esid: sec-import-call-runtime-semantics-evaluation
info: | info: |
ImportCall : ImportCall :
......
// 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);
// 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 }*/;
};
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
path: language/module-code/dynamic-import/syntax/valid/nested-do-while- 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 esid: sec-import-call-runtime-semantics-evaluation
info: | info: |
ImportCall : ImportCall :
......
// 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);
// 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 }*/;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment