Add Async Functions to function templates

This commit is contained in:
Leo Balter 2017-04-20 15:03:06 -04:00
parent 234962036a
commit de15143976
No known key found for this signature in database
GPG Key ID: 2C75F319D398E36B
29 changed files with 1029 additions and 2 deletions

View File

@ -0,0 +1,41 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-arrow-function/
name: async arrow function expression
esid: sec-async-arrow-function-definitions
info: |
14.7 Async Arrow Function Definitions
AsyncArrowFunction :
...
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
AsyncConciseBody :
{ AsyncFunctionBody }
...
Supplemental Syntax
When processing an instance of the production AsyncArrowFunction :
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
AsyncArrowHead :
async ArrowFormalParameters
flags: [async]
---*/
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref = async (/*{ params }*/) => {
/*{ body }*/
callCount = callCount + 1;
};
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
}).then($DONE, $DONE);

View File

@ -0,0 +1,26 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/async-function/
name: async function declaration
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/
var callCount = 0;
// Stores a reference `ref` for case evaluation
async function ref(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);

View File

@ -0,0 +1,27 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/named-
name: async function named expression
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function ref(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
};
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);

View File

@ -0,0 +1,27 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/nameless-
name: async function nameless expression
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/
var callCount = 0;
// Stores a reference `ref` for case evaluation
var ref;
ref = async function(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
};
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'function invoked exactly once');
}).then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/async-meth-
name: async method
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncMethod :
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/
var callCount = 0;
var __obj = {
async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
// Stores a reference `ref` for case evaluation
var ref = __obj.method;
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'async method invoked exactly once');
}).then($DONE, $DONE);

View File

@ -3,7 +3,7 @@
/*---
path: language/statements/class/async-gen-meth-static-
name: static class expression generator method
name: static class declaration async generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-gen-meth-
name: class expression method
name: class declaration async generator method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail

View File

@ -0,0 +1,53 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-meth-static-
name: static class declaration async method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation for
m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
class C {
static async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
}
// Stores a reference `ref` for case evaluation
var ref = C.method;
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'method invoked exactly once');
}).then($DONE, $DONE);

View File

@ -0,0 +1,53 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-meth-
name: class declaration async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
class C {
async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
}
// Stores a reference `ref` for case evaluation
var ref = C.prototype.method;
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'method invoked exactly once');
}).then($DONE, $DONE);

View File

@ -0,0 +1,53 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-meth-static-
name: static class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation
for m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var C = class {
static async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
}
// Stores a reference `ref` for case evaluation
var ref = C.method;
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'method invoked exactly once');
}).then($DONE, $DONE);

View File

@ -0,0 +1,53 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-meth-
name: class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var C = class {
async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
}
// Stores a reference `ref` for case evaluation
var ref = C.prototype.method;
ref(/*{ args }*/).then(() => {
assert.sameValue(callCount, 1, 'method invoked exactly once');
}).then($DONE, $DONE);

View File

@ -0,0 +1,45 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-arrow-function/
name: async arrow function expression
esid: sec-async-arrow-function-definitions
info: |
14.7 Async Arrow Function Definitions
AsyncArrowFunction :
...
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
AsyncConciseBody :
{ AsyncFunctionBody }
...
Supplemental Syntax
When processing an instance of the production AsyncArrowFunction :
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
AsyncArrowHead :
async ArrowFormalParameters
flags: [async]
---*/
var callCount = 0;
var f;
f = async (/*{ params }*/) => {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/async-function/
name: async function declaration
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/
var callCount = 0;
async function f(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/named-
name: async function named expression
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/
var callCount = 0;
var f = async function f(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/nameless-
name: async function nameless expression
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/
var callCount = 0;
var f = async function(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,32 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/async-meth-
name: async method
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncMethod :
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/
var callCount = 0;
var obj = {
async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
obj.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,55 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-meth-static-
name: static class declaration async method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation for
m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
class C {
static async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
}
C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,55 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-meth-
name: class declaration async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
class C {
async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
}
C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,57 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-meth-static-
name: static class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation
for m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var C = class {
static async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,56 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-meth-
name: class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var C = class {
async method(/*{ params }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,32 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-arrow-function/
name: async arrow function expression
esid: sec-async-arrow-function-definitions
info: |
14.7 Async Arrow Function Definitions
AsyncArrowFunction :
...
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
AsyncConciseBody :
{ AsyncFunctionBody }
...
Supplemental Syntax
When processing an instance of the production AsyncArrowFunction :
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
AsyncArrowHead :
async ArrowFormalParameters
---*/
(async (/*{ params }*/) => {
/*{ body }*/
});

View File

@ -0,0 +1,17 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/async-function/
name: async function declaration
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
---*/
async function f(/*{ params }*/) {
/*{ body }*/
}

View File

@ -0,0 +1,18 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/named-
name: async function named expression
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
---*/
(async function f(/*{ params }*/) {
/*{ body }*/
});

View File

@ -0,0 +1,17 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/nameless-
name: async function nameless expression
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody }
---*/
(async function(/*{ params }*/) {
/*{ body }*/
});

View File

@ -0,0 +1,19 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/async-meth-
name: async method
esid: sec-async-function-definitions
info: |
14.6 Async Function Definitions
AsyncMethod :
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
---*/
({
async *method(/*{ params }*/) {
/*{ body }*/
}
});

View File

@ -0,0 +1,43 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-meth-static-
name: static class declaration async method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation for
m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
---*/
class C {
static async method(/*{ params }*/) {
/*{ body }*/
}
}

View File

@ -0,0 +1,44 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-meth-
name: class declaration async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
---*/
class C {
async method(/*{ params }*/) {
/*{ body }*/
}
}

View File

@ -0,0 +1,44 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-meth-static-
name: static class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation
for m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
---*/
var C = class {
static async method(/*{ params }*/) {
/*{ body }*/
}
};

View File

@ -0,0 +1,44 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-meth-
name: class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
let strict be false.
4. Let scope be the LexicalEnvironment of the running execution context.
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
scope, strict).
[...]
---*/
var C = class {
static async method(/*{ params }*/) {
/*{ body }*/
}
};