Add default templates for async arrow fns and async generators

This commit is contained in:
Leo Balter 2018-10-17 12:00:55 -04:00 committed by Rick Waldron
parent a4d102e020
commit 335156f861
14 changed files with 418 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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