15.9 Async Arrow Function Definitions
Syntax
Supplemental Syntax
When processing an instance of the production
the interpretation of
15.9.1 Static Semantics: Early Errors
- It is a Syntax Error if any element of the
BoundNames ofAsyncArrowBindingIdentifier also occurs in theLexicallyDeclaredNames ofAsyncConciseBody .
CoverCallExpressionAndAsyncArrowHead must cover anAsyncArrowHead .- It is a Syntax Error if
CoverCallExpressionAndAsyncArrowHead Contains YieldExpression istrue . - It is a Syntax Error if
CoverCallExpressionAndAsyncArrowHead Contains AwaitExpression istrue . - It is a Syntax Error if any element of the
BoundNames ofCoverCallExpressionAndAsyncArrowHead also occurs in theLexicallyDeclaredNames ofAsyncConciseBody . - It is a Syntax Error if
AsyncConciseBodyContainsUseStrict ofAsyncConciseBody istrue andIsSimpleParameterList ofCoverCallExpressionAndAsyncArrowHead isfalse .
15.9.2 Static Semantics: AsyncConciseBodyContainsUseStrict
The
- Return
false .
- Return
FunctionBodyContainsUseStrict ofAsyncFunctionBody .
15.9.3 Runtime Semantics: EvaluateAsyncConciseBody
The
- Let promiseCapability be !
NewPromiseCapability (%Promise% ). - Let declResult be
Completion (FunctionDeclarationInstantiation (functionObject, argumentsList)). - If declResult is an
abrupt completion , then- Perform !
Call (promiseCapability.[[Reject]],undefined , « declResult.[[Value]] »).
- Perform !
- Else,
- Perform
AsyncFunctionStart (promiseCapability,ExpressionBody ).
- Perform
- Return
Completion Record { [[Type]]:return , [[Value]]: promiseCapability.[[Promise]], [[Target]]:empty }.
15.9.4 Runtime Semantics: InstantiateAsyncArrowFunctionExpression
The
- If name is not present, set name to
"" . - Let env be the LexicalEnvironment of the
running execution context . - Let privateEnv be the
running execution context 's PrivateEnvironment. - Let sourceText be the
source text matched by AsyncArrowFunction . - Let parameters be
AsyncArrowBindingIdentifier . - Let closure be
OrdinaryFunctionCreate (%AsyncFunction.prototype% , sourceText, parameters,AsyncConciseBody ,lexical-this , env, privateEnv). - Perform
SetFunctionName (closure, name). - Return closure.
- If name is not present, set name to
"" . - Let env be the LexicalEnvironment of the
running execution context . - Let privateEnv be the
running execution context 's PrivateEnvironment. - Let sourceText be the
source text matched by AsyncArrowFunction . - Let head be the
AsyncArrowHead that iscovered byCoverCallExpressionAndAsyncArrowHead . - Let parameters be the
ArrowFormalParameters of head. - Let closure be
OrdinaryFunctionCreate (%AsyncFunction.prototype% , sourceText, parameters,AsyncConciseBody ,lexical-this , env, privateEnv). - Perform
SetFunctionName (closure, name). - Return closure.