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

This commit is contained in:
Leo Balter 2018-10-03 13:32:55 -04:00 committed by Rick Waldron
parent 24d1a78015
commit 8b021346a5
17 changed files with 41 additions and 276 deletions

View File

@ -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()

View File

@ -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 :

View File

@ -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);

View File

@ -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);
};

View File

@ -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)
##

View File

@ -29,7 +29,7 @@ async function f() {
/*{ body }*/
}).then($DONE, $DONE).catch($DONE);
});
}
f();
f().then($DONE, $DONE).catch($DONE);

View File

@ -25,11 +25,11 @@ flags: [async]
---*/
async function f() {
return await import(/*{ params }*/).then(imported => {
/*{ body }*/
}).then($DONE, $DONE).catch($DONE);
return await import(/*{ params }*/);
}
f();
f().then(imported => {
/*{ body }*/
}).then($DONE, $DONE).catch($DONE);

View File

@ -33,4 +33,3 @@ async function f() {
}
f();

View File

@ -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 :

View File

@ -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);

View File

@ -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);
};

View File

@ -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 :

View File

@ -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);

View File

@ -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 }*/;
};

View File

@ -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 :

View File

@ -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);

View File

@ -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 }*/;
};