15.9 Async Arrow Function Definitions

Syntax

AsyncArrowFunction[In, Yield, Await] : async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In] AsyncConciseBody[In] : [lookahead ≠ {] ExpressionBody[?In, +Await] { AsyncFunctionBody } AsyncArrowBindingIdentifier[Yield] : BindingIdentifier[?Yield, +Await] CoverCallExpressionAndAsyncArrowHead[Yield, Await] : MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]

Supplemental Syntax

When processing an instance of the production
AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
the interpretation of CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:

AsyncArrowHead : async [no LineTerminator here] ArrowFormalParameters[~Yield, +Await]

15.9.1 Static Semantics: Early Errors

AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody

15.9.2 Static Semantics: CoveredAsyncArrowHead

CoverCallExpressionAndAsyncArrowHead : MemberExpression Arguments
  1. Return the AsyncArrowHead that is covered by CoverCallExpressionAndAsyncArrowHead.

15.9.3 Static Semantics: AsyncConciseBodyContainsUseStrict

AsyncConciseBody : ExpressionBody
  1. Return false.
AsyncConciseBody : { AsyncFunctionBody }
  1. Return FunctionBodyContainsUseStrict of AsyncFunctionBody.

15.9.4 Runtime Semantics: EvaluateAsyncConciseBody

With parameters functionObject and argumentsList (a List).

AsyncConciseBody : ExpressionBody
  1. Let promiseCapability be ! NewPromiseCapability(%Promise%).
  2. Let declResult be FunctionDeclarationInstantiation(functionObject, argumentsList).
  3. If declResult is not an abrupt completion, then
    1. Perform ! AsyncFunctionStart(promiseCapability, ExpressionBody).
  4. Else,
    1. Perform ! Call(promiseCapability.[[Reject]], undefined, « declResult.[[Value]] »).
  5. Return Completion { [[Type]]: return, [[Value]]: promiseCapability.[[Promise]], [[Target]]: empty }.

15.9.5 Runtime Semantics: InstantiateAsyncArrowFunctionExpression

With optional parameter name.

AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody
  1. If name is not present, set name to "".
  2. Let scope be the LexicalEnvironment of the running execution context.
  3. Let sourceText be the source text matched by AsyncArrowFunction.
  4. Let parameters be AsyncArrowBindingIdentifier.
  5. Let closure be ! OrdinaryFunctionCreate(%AsyncFunction.prototype%, sourceText, parameters, AsyncConciseBody, lexical-this, scope).
  6. Perform SetFunctionName(closure, name).
  7. Return closure.
AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
  1. If name is not present, set name to "".
  2. Let scope be the LexicalEnvironment of the running execution context.
  3. Let sourceText be the source text matched by AsyncArrowFunction.
  4. Let head be CoveredAsyncArrowHead of CoverCallExpressionAndAsyncArrowHead.
  5. Let parameters be the ArrowFormalParameters of head.
  6. Let closure be ! OrdinaryFunctionCreate(%AsyncFunction.prototype%, sourceText, parameters, AsyncConciseBody, lexical-this, scope).
  7. Perform SetFunctionName(closure, name).
  8. Return closure.

15.9.6 Runtime Semantics: Evaluation

AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
  1. Return InstantiateAsyncArrowFunctionExpression of AsyncArrowFunction.