diff --git a/spec.html b/spec.html
index f8252b6825..a65dad7e5d 100644
--- a/spec.html
+++ b/spec.html
@@ -1876,6 +1876,26 @@
%Int8Array%
@@ -6861,7 +6881,6 @@ OrdinaryCallBindThis ( _F_, _calleeContext_, _thisArgument_ )
OrdinaryCallEvaluateBody ( _F_, _argumentsList_ )
When the abstract operation OrdinaryCallEvaluateBody is called with function object _F_ and List _argumentsList_, the following steps are taken:
- 1. Perform ? FunctionDeclarationInstantiation(_F_, _argumentsList_).
1. Return the result of EvaluateBody of the parsed code that is _F_.[[ECMAScriptCode]] passing _F_ as the argument.
@@ -8849,7 +8868,7 @@ Types of Source Code
- Function code is generally provided as the bodies of Function Definitions (), Arrow Function Definitions (), Method Definitions () and Generator Definitions (). Function code is also derived from the arguments to the `Function` constructor () and the GeneratorFunction constructor ().
+ Function code is generally provided as the bodies of Function Definitions (), Arrow Function Definitions (), Method Definitions (), Generator Definitions (), Async Function Definitions (), and Async Arrow Functions (). Function code is also derived from the arguments to the `Function` constructor () and the GeneratorFunction constructor ().
@@ -9368,7 +9387,7 @@ Keywords
Syntax
Keyword :: one of
- `break` `do` `in` `typeof` `case` `else` `instanceof` `var` `catch` `export` `new` `void` `class` `extends` `return` `while` `const` `finally` `super` `with` `continue` `for` `switch` `yield` `debugger` `function` `this` `default` `if` `throw` `delete` `import` `try`
+ `break` `do` `in` `typeof` `case` `else` `instanceof` `var` `catch` `export` `new` `void` `class` `extends` `return` `while` `const` `finally` `super` `with` `continue` `for` `switch` `yield` `debugger` `function` `this` `default` `if` `throw` `delete` `import` `try` `await`
In some contexts `yield` is given the semantics of an |Identifier|. See . In strict mode code, `let` and `static` are treated as reserved keywords through static semantic restrictions (see , , , and ) rather than the lexical grammar.
@@ -10354,31 +10373,31 @@ Rules of Automatic Semicolon Insertion
The following are the only restricted productions in the grammar:
- UpdateExpression[Yield] :
- LeftHandSideExpression[?Yield] [no LineTerminator here] `++`
- LeftHandSideExpression[?Yield] [no LineTerminator here] `--`
+ UpdateExpression[Yield, Await] :
+ LeftHandSideExpression[?Yield, ?Await] [no LineTerminator here] `++`
+ LeftHandSideExpression[?Yield, ?Await] [no LineTerminator here] `--`
- ContinueStatement[Yield] :
+ ContinueStatement[Yield, Await] :
`continue` `;`
- `continue` [no LineTerminator here] LabelIdentifier[?Yield] `;`
+ `continue` [no LineTerminator here] LabelIdentifier[?Yield, ?Await] `;`
- BreakStatement[Yield] :
+ BreakStatement[Yield, Await] :
`break` `;`
- `break` [no LineTerminator here] LabelIdentifier[?Yield] `;`
+ `break` [no LineTerminator here] LabelIdentifier[?Yield, ?Await] `;`
- ReturnStatement[Yield] :
+ ReturnStatement[Yield, Await] :
`return` `;`
- `return` [no LineTerminator here] Expression[+In, ?Yield] `;`
+ `return` [no LineTerminator here] Expression[+In, ?Yield, ?Await] `;`
- ThrowStatement[Yield] :
- `throw` [no LineTerminator here] Expression[+In, ?Yield] `;`
+ ThrowStatement[Yield, Await] :
+ `throw` [no LineTerminator here] Expression[+In, ?Yield, ?Await] `;`
- ArrowFunction[In, Yield] :
- ArrowParameters[?Yield] [no LineTerminator here] `=>` ConciseBody[?In]
+ ArrowFunction[In, Yield, Await] :
+ ArrowParameters[?Yield, ?Await] [no LineTerminator here] `=>` ConciseBody[?In]
- YieldExpression[In] :
- `yield` [no LineTerminator here] `*` AssignmentExpression[?In, +Yield]
- `yield` [no LineTerminator here] AssignmentExpression[?In, +Yield]
+ YieldExpression[In, Await] :
+ `yield` [no LineTerminator here] `*` AssignmentExpression[?In, +Yield, ?Await]
+ `yield` [no LineTerminator here] AssignmentExpression[?In, +Yield, ?Await]
The practical effect of these restricted productions is as follows:
@@ -10479,17 +10498,20 @@ ECMAScript Language: Expressions
Identifiers
Syntax
- IdentifierReference[Yield] :
+ IdentifierReference[Yield, Await] :
Identifier
[~Yield] `yield`
+ [~Await] `await`
- BindingIdentifier[Yield] :
+ BindingIdentifier[Yield, Await] :
Identifier
[~Yield] `yield`
+ [~Await] `await`
- LabelIdentifier[Yield] :
+ LabelIdentifier[Yield, Await] :
Identifier
[~Yield] `yield`
+ [~Await] `await`
Identifier :
IdentifierName but not ReservedWord
@@ -10517,16 +10539,19 @@ Static Semantics: Early Errors
- IdentifierReference[Yield] : Identifier
+ IdentifierReference[Yield, Await] : Identifier
- BindingIdentifier[Yield] : Identifier
+ BindingIdentifier[Yield, Await] : Identifier
- LabelIdentifier[Yield] : Identifier
+ LabelIdentifier[Yield, Await] : Identifier
-
It is a Syntax Error if this production has a [Yield] parameter and StringValue of |Identifier| is `"yield"`.
+ -
+ It is a Syntax Error if this production has an [Await] parameter and StringValue of |Identifier| is `"await"`.
+
Identifier : IdentifierName but not ReservedWord
@@ -10650,37 +10675,38 @@ Runtime Semantics: Evaluation
Primary Expression
Syntax
- PrimaryExpression[Yield] :
+ PrimaryExpression[Yield, Await] :
`this`
- IdentifierReference[?Yield]
+ IdentifierReference[?Yield, ?Await]
Literal
- ArrayLiteral[?Yield]
- ObjectLiteral[?Yield]
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
FunctionExpression
- ClassExpression[?Yield]
+ ClassExpression[?Yield, ?Await]
GeneratorExpression
+ AsyncFunctionExpression
RegularExpressionLiteral
- TemplateLiteral[?Yield]
- CoverParenthesizedExpressionAndArrowParameterList[?Yield] #parencover
+ TemplateLiteral[?Yield, ?Await]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] #parencover
- CoverParenthesizedExpressionAndArrowParameterList[Yield] :
- `(` Expression[+In, ?Yield] `)`
- `(` Expression[+In, ?Yield] `,` `)`
+ CoverParenthesizedExpressionAndArrowParameterList[Yield, Await] :
+ `(` Expression[+In, ?Yield, ?Await] `)`
+ `(` Expression[+In, ?Yield, ?Await] `,` `)`
`(` `)`
- `(` `...` BindingIdentifier[?Yield] `)`
- `(` `...` BindingPattern[?Yield] `)`
- `(` Expression[+In, ?Yield] `,` `...` BindingIdentifier[?Yield] `)`
- `(` Expression[+In, ?Yield] `,` `...` BindingPattern[?Yield] `)`
+ `(` `...` BindingIdentifier[?Yield, ?Await] `)`
+ `(` `...` BindingPattern[?Yield, ?Await] `)`
+ `(` Expression[+In, ?Yield, ?Await] `,` `...` BindingIdentifier[?Yield, ?Await] `)`
+ `(` Expression[+In, ?Yield, ?Await] `,` `...` BindingPattern[?Yield, ?Await] `)`
Supplemental Syntax
When processing the production
- PrimaryExpression[Yield] : CoverParenthesizedExpressionAndArrowParameterList[?Yield]
+ PrimaryExpression[Yield, Await] : CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
the interpretation of |CoverParenthesizedExpressionAndArrowParameterList| is refined using the following grammar:
- ParenthesizedExpression[Yield] :
- `(` Expression[+In, ?Yield] `)`
+ ParenthesizedExpression[Yield, Await] :
+ `(` Expression[+In, ?Yield, ?Await] `)`
@@ -10690,9 +10716,9 @@ Semantics
Static Semantics: CoveredParenthesizedExpression
- CoverParenthesizedExpressionAndArrowParameterList[Yield] : `(` Expression[+In, ?Yield] `)`
+ CoverParenthesizedExpressionAndArrowParameterList[Yield, Await] : `(` Expression[+In, ?Yield, ?Await] `)`
- 1. Return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList[Yield]| using either |ParenthesizedExpression[~Yield]| or |ParenthesizedExpression[+Yield]| as the goal symbol depending upon whether the [Yield] grammar parameter was present when |CoverParenthesizedExpressionAndArrowParameterList| was matched.
+ 1. Return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList| using |ParenthesizedExpression| as the goal symbol with its [Yield] and [Await] parameters set to the values used when parsing this |CoverParenthesizedExpressionAndArrowParameterList|.
@@ -10849,23 +10875,23 @@ Array Initializer
Array elements may be elided at the beginning, middle or end of the element list. Whenever a comma in the element list is not preceded by an |AssignmentExpression| (i.e., a comma at the beginning or after another comma), the missing array element contributes to the length of the Array and increases the index of subsequent elements. Elided array elements are not defined. If an element is elided at the end of an array, that element does not contribute to the length of the Array.
Syntax
- ArrayLiteral[Yield] :
+ ArrayLiteral[Yield, Await] :
`[` Elision? `]`
- `[` ElementList[?Yield] `]`
- `[` ElementList[?Yield] `,` Elision? `]`
+ `[` ElementList[?Yield, ?Await] `]`
+ `[` ElementList[?Yield, ?Await] `,` Elision? `]`
- ElementList[Yield] :
- Elision? AssignmentExpression[+In, ?Yield]
- Elision? SpreadElement[?Yield]
- ElementList[?Yield] `,` Elision? AssignmentExpression[+In, ?Yield]
- ElementList[?Yield] `,` Elision? SpreadElement[?Yield]
+ ElementList[Yield, Await] :
+ Elision? AssignmentExpression[+In, ?Yield, ?Await]
+ Elision? SpreadElement[?Yield, ?Await]
+ ElementList[?Yield, ?Await] `,` Elision? AssignmentExpression[+In, ?Yield, ?Await]
+ ElementList[?Yield, ?Await] `,` Elision? SpreadElement[?Yield, ?Await]
Elision :
`,`
Elision `,`
- SpreadElement[Yield] :
- `...` AssignmentExpression[+In, ?Yield]
+ SpreadElement[Yield, Await] :
+ `...` AssignmentExpression[+In, ?Yield, ?Await]
@@ -10977,38 +11003,38 @@ Object Initializer
Syntax
- ObjectLiteral[Yield] :
+ ObjectLiteral[Yield, Await] :
`{` `}`
- `{` PropertyDefinitionList[?Yield] `}`
- `{` PropertyDefinitionList[?Yield] `,` `}`
+ `{` PropertyDefinitionList[?Yield, ?Await] `}`
+ `{` PropertyDefinitionList[?Yield, ?Await] `,` `}`
- PropertyDefinitionList[Yield] :
- PropertyDefinition[?Yield]
- PropertyDefinitionList[?Yield] `,` PropertyDefinition[?Yield]
+ PropertyDefinitionList[Yield, Await] :
+ PropertyDefinition[?Yield, ?Await]
+ PropertyDefinitionList[?Yield, ?Await] `,` PropertyDefinition[?Yield, ?Await]
- PropertyDefinition[Yield] :
- IdentifierReference[?Yield]
- CoverInitializedName[?Yield]
- PropertyName[?Yield] `:` AssignmentExpression[+In, ?Yield]
- MethodDefinition[?Yield]
+ PropertyDefinition[Yield, Await] :
+ IdentifierReference[?Yield, ?Await]
+ CoverInitializedName[?Yield, ?Await]
+ PropertyName[?Yield, ?Await] `:` AssignmentExpression[+In, ?Yield, ?Await]
+ MethodDefinition[?Yield, ?Await]
- PropertyName[Yield] :
+ PropertyName[Yield, Await] :
LiteralPropertyName
- ComputedPropertyName[?Yield]
+ ComputedPropertyName[?Yield, ?Await]
LiteralPropertyName :
IdentifierName
StringLiteral
NumericLiteral
- ComputedPropertyName[Yield] :
- `[` AssignmentExpression[+In, ?Yield] `]`
+ ComputedPropertyName[Yield, Await] :
+ `[` AssignmentExpression[+In, ?Yield, ?Await] `]`
- CoverInitializedName[Yield] :
- IdentifierReference[?Yield] Initializer[+In, ?Yield]
+ CoverInitializedName[Yield, Await] :
+ IdentifierReference[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]
- Initializer[In, Yield] :
- `=` AssignmentExpression[?In, ?Yield]
+ Initializer[In, Yield, Await] :
+ `=` AssignmentExpression[?In, ?Yield, ?Await]
|MethodDefinition| is defined in .
@@ -11026,7 +11052,7 @@ Static Semantics: Early Errors
It is a Syntax Error if HasDirectSuper of |MethodDefinition| is *true*.
- In addition to describing an actual object initializer the |ObjectLiteral| productions are also used as a cover grammar for |ObjectAssignmentPattern|. and may be recognized as part of a |CoverParenthesizedExpressionAndArrowParameterList|. When |ObjectLiteral| appears in a context where |ObjectAssignmentPattern| is required the following Early Error rules are not applied. In addition, they are not applied when initially parsing a |CoverParenthesizedExpressionAndArrowParameterList|.
+ In addition to describing an actual object initializer the |ObjectLiteral| productions are also used as a cover grammar for |ObjectAssignmentPattern| and may be recognized as part of a |CoverParenthesizedExpressionAndArrowParameterList|. When |ObjectLiteral| appears in a context where |ObjectAssignmentPattern| is required the following Early Error rules are not applied. In addition, they are not applied when initially parsing a |CoverParenthesizedExpressionAndArrowParameterList|.
PropertyDefinition : CoverInitializedName
-
@@ -11217,6 +11243,7 @@
Function Defining Expressions
See for PrimaryExpression : FunctionExpression.
See for PrimaryExpression : GeneratorExpression.
See for PrimaryExpression : ClassExpression.
+ See for PrimaryExpression : AsyncFunctionExpression.
@@ -11256,17 +11283,17 @@ Runtime Semantics: Evaluation
Template Literals
Syntax
- TemplateLiteral[Yield] :
+ TemplateLiteral[Yield, Await] :
NoSubstitutionTemplate
- TemplateHead Expression[+In, ?Yield] TemplateSpans[?Yield]
+ TemplateHead Expression[+In, ?Yield, ?Await] TemplateSpans[?Yield, ?Await]
- TemplateSpans[Yield] :
+ TemplateSpans[Yield, Await] :
TemplateTail
- TemplateMiddleList[?Yield] TemplateTail
+ TemplateMiddleList[?Yield, ?Await] TemplateTail
- TemplateMiddleList[Yield] :
- TemplateMiddle Expression[+In, ?Yield]
- TemplateMiddleList[?Yield] TemplateMiddle Expression[+In, ?Yield]
+ TemplateMiddleList[Yield, Await] :
+ TemplateMiddle Expression[+In, ?Yield, ?Await]
+ TemplateMiddleList[?Yield, ?Await] TemplateMiddle Expression[+In, ?Yield, ?Await]
@@ -11539,17 +11566,17 @@ Runtime Semantics: Evaluation
Left-Hand-Side Expressions
Syntax
- MemberExpression[Yield] :
- PrimaryExpression[?Yield]
- MemberExpression[?Yield] `[` Expression[+In, ?Yield] `]`
- MemberExpression[?Yield] `.` IdentifierName
- MemberExpression[?Yield] TemplateLiteral[?Yield]
- SuperProperty[?Yield]
+ MemberExpression[Yield, Await] :
+ PrimaryExpression[?Yield, ?Await]
+ MemberExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await] `]`
+ MemberExpression[?Yield, ?Await] `.` IdentifierName
+ MemberExpression[?Yield, ?Await] TemplateLiteral[?Yield, ?Await]
+ SuperProperty[?Yield, ?Await]
MetaProperty
- `new` MemberExpression[?Yield] Arguments[?Yield]
+ `new` MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
- SuperProperty[Yield] :
- `super` `[` Expression[+In, ?Yield] `]`
+ SuperProperty[Yield, Await] :
+ `super` `[` Expression[+In, ?Yield, ?Await] `]`
`super` `.` IdentifierName
MetaProperty :
@@ -11558,41 +11585,57 @@ Syntax
NewTarget :
`new` `.` `target`
- NewExpression[Yield] :
- MemberExpression[?Yield]
- `new` NewExpression[?Yield]
+ NewExpression[Yield, Await] :
+ MemberExpression[?Yield, ?Await]
+ `new` NewExpression[?Yield, ?Await]
- CallExpression[Yield] :
- MemberExpression[?Yield] Arguments[?Yield]
- SuperCall[?Yield]
- CallExpression[?Yield] Arguments[?Yield]
- CallExpression[?Yield] `[` Expression[+In, ?Yield] `]`
- CallExpression[?Yield] `.` IdentifierName
- CallExpression[?Yield] TemplateLiteral[?Yield]
+ CallExpression[Yield, Await] :
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] #callcover
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await] `]`
+ CallExpression[?Yield, ?Await] `.` IdentifierName
+ CallExpression[?Yield, ?Await] TemplateLiteral[?Yield, ?Await]
- SuperCall[Yield] :
- `super` Arguments[?Yield]
+ SuperCall[Yield, Await] :
+ `super` Arguments[?Yield, ?Await]
- Arguments[Yield] :
+ Arguments[Yield, Await] :
`(` `)`
- `(` ArgumentList[?Yield] `)`
- `(` ArgumentList[?Yield] `,` `)`
-
- ArgumentList[Yield] :
- AssignmentExpression[+In, ?Yield]
- `...` AssignmentExpression[+In, ?Yield]
- ArgumentList[?Yield] `,` AssignmentExpression[+In, ?Yield]
- ArgumentList[?Yield] `,` `...` AssignmentExpression[+In, ?Yield]
-
- LeftHandSideExpression[Yield] :
- NewExpression[?Yield]
- CallExpression[?Yield]
+ `(` ArgumentList[?Yield, ?Await] `)`
+ `(` ArgumentList[?Yield, ?Await] `,` `)`
+
+ ArgumentList[Yield, Await] :
+ AssignmentExpression[+In, ?Yield, ?Await]
+ `...` AssignmentExpression[+In, ?Yield, ?Await]
+ ArgumentList[?Yield, ?Await] `,` AssignmentExpression[+In, ?Yield, ?Await]
+ ArgumentList[?Yield, ?Await] `,` `...` AssignmentExpression[+In, ?Yield, ?Await]
+
+ LeftHandSideExpression[Yield, Await] :
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ Supplemental Syntax
+ When processing the production CallExpression : CoverCallExpressionAndAsyncArrowHead the interpretation of |CoverCallExpressionAndAsyncArrowHead| is refined using the following grammar:
+
+ CallMemberExpression[Yield, Await] :
+ MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
Static Semantics
+
+ Static Semantics: CoveredCallExpression
+
+ CallExpression : CoverCallExpressionAndAsyncArrowHead
+
+
+ 1. Return the result of parsing the lexical token stream matched by |CoverCallExpressionAndAsyncArrowHead| using |CallMemberExpression| as the goal symbol with its [Yield] and [Await] parameters set to the values used when parsing |CoverCallExpressionAndAsyncArrowHead|.
+
+
+
Static Semantics: Contains
@@ -11638,7 +11681,7 @@ Static Semantics: IsFunctionDefinition
`new` NewExpression
CallExpression :
- MemberExpression Arguments
+ CoverCallExpressionAndAsyncArrowHead
SuperCall
CallExpression Arguments
CallExpression `[` Expression `]`
@@ -11672,7 +11715,7 @@ Static Semantics: IsDestructuring
`new` NewExpression
CallExpression :
- MemberExpression Arguments
+ CoverCallExpressionAndAsyncArrowHead
SuperCall
CallExpression Arguments
CallExpression `[` Expression `]`
@@ -11727,7 +11770,7 @@ Static Semantics: IsValidSimpleAssignmentTarget
CallExpression :
- MemberExpression Arguments
+ CoverCallExpressionAndAsyncArrowHead
SuperCall
CallExpression Arguments
CallExpression TemplateLiteral
@@ -11856,13 +11899,16 @@ Function Calls
Runtime Semantics: Evaluation
- CallExpression : MemberExpression Arguments
+ CallExpression : CoverCallExpressionAndAsyncArrowHead
- 1. Let _ref_ be the result of evaluating |MemberExpression|.
+ 1. Let _expr_ be CoveredCallExpression of |CoverCallExpressionAndAsyncArrowHead|.
+ 1. Let _memberExpr_ be the |MemberExpression| of _expr_.
+ 1. Let _arguments_ be the |Arguments| of _expr_.
+ 1. Let _ref_ be the result of evaluating _memberExpr_.
1. Let _func_ be ? GetValue(_ref_).
1. If Type(_ref_) is Reference and IsPropertyReference(_ref_) is *false* and GetReferencedName(_ref_) is `"eval"`, then
1. If SameValue(_func_, %eval%) is *true*, then
- 1. Let _argList_ be ? ArgumentListEvaluation(|Arguments|).
+ 1. Let _argList_ be ? ArgumentListEvaluation(_arguments_).
1. If _argList_ has no elements, return *undefined*.
1. Let _evalText_ be the first element of _argList_.
1. If the source code matching this |CallExpression| is strict mode code, let _strictCaller_ be *true*. Otherwise let _strictCaller_ be *false*.
@@ -11879,7 +11925,7 @@ Runtime Semantics: Evaluation
1. Let _thisValue_ be *undefined*.
1. Let _thisCall_ be this |CallExpression|.
1. Let _tailCall_ be IsInTailPosition(_thisCall_).
- 1. Return ? EvaluateDirectCall(_func_, _thisValue_, |Arguments|, _tailCall_).
+ 1. Return ? EvaluateDirectCall(_func_, _thisValue_, _arguments_, _tailCall_).
A |CallExpression| evaluation that executes step 3.a.vii is a direct eval.
CallExpression : CallExpression Arguments
@@ -12093,12 +12139,12 @@ Runtime Semantics: Evaluation
Update Expressions
Syntax
- UpdateExpression[Yield] :
- LeftHandSideExpression[?Yield]
- LeftHandSideExpression[?Yield] [no LineTerminator here] `++`
- LeftHandSideExpression[?Yield] [no LineTerminator here] `--`
- `++` UnaryExpression[?Yield]
- `--` UnaryExpression[?Yield]
+ UpdateExpression[Yield, Await] :
+ LeftHandSideExpression[?Yield, ?Await]
+ LeftHandSideExpression[?Yield, ?Await] [no LineTerminator here] `++`
+ LeftHandSideExpression[?Yield, ?Await] [no LineTerminator here] `--`
+ `++` UnaryExpression[?Yield, ?Await]
+ `--` UnaryExpression[?Yield, ?Await]
@@ -12237,15 +12283,16 @@ Runtime Semantics: Evaluation
Unary Operators
Syntax
- UnaryExpression[Yield] :
- UpdateExpression[?Yield]
- `delete` UnaryExpression[?Yield]
- `void` UnaryExpression[?Yield]
- `typeof` UnaryExpression[?Yield]
- `+` UnaryExpression[?Yield]
- `-` UnaryExpression[?Yield]
- `~` UnaryExpression[?Yield]
- `!` UnaryExpression[?Yield]
+ UnaryExpression[Yield, Await] :
+ UpdateExpression[?Yield, ?Await]
+ `delete` UnaryExpression[?Yield, ?Await]
+ `void` UnaryExpression[?Yield, ?Await]
+ `typeof` UnaryExpression[?Yield, ?Await]
+ `+` UnaryExpression[?Yield, ?Await]
+ `-` UnaryExpression[?Yield, ?Await]
+ `~` UnaryExpression[?Yield, ?Await]
+ `!` UnaryExpression[?Yield, ?Await]
+ [+Await] AwaitExpression[?Yield]
@@ -12261,6 +12308,7 @@ Static Semantics: IsFunctionDefinition
`-` UnaryExpression
`~` UnaryExpression
`!` UnaryExpression
+ AwaitExpression
1. Return *false*.
@@ -12281,6 +12329,7 @@ Static Semantics: IsValidSimpleAssignmentTarget
`-` UnaryExpression
`~` UnaryExpression
`!` UnaryExpression
+ AwaitExpression
1. Return *false*.
@@ -12551,9 +12600,9 @@ Exponentiation Operator
Syntax
- ExponentiationExpression[Yield] :
- UnaryExpression[?Yield]
- UpdateExpression[?Yield] `**` ExponentiationExpression[?Yield]
+ ExponentiationExpression[Yield, Await] :
+ UnaryExpression[?Yield, ?Await]
+ UpdateExpression[?Yield, ?Await] `**` ExponentiationExpression[?Yield, ?Await]
@@ -12602,9 +12651,9 @@ Runtime Semantics: Evaluation
Multiplicative Operators
Syntax
- MultiplicativeExpression[Yield] :
- ExponentiationExpression[?Yield]
- MultiplicativeExpression[?Yield] MultiplicativeOperator ExponentiationExpression[?Yield]
+ MultiplicativeExpression[Yield, Await] :
+ ExponentiationExpression[?Yield, ?Await]
+ MultiplicativeExpression[?Yield, ?Await] MultiplicativeOperator ExponentiationExpression[?Yield, ?Await]
MultiplicativeOperator : one of
`*` `/` `%`
@@ -12778,10 +12827,10 @@ Applying the `**` Operator
Additive Operators
Syntax
- AdditiveExpression[Yield] :
- MultiplicativeExpression[?Yield]
- AdditiveExpression[?Yield] `+` MultiplicativeExpression[?Yield]
- AdditiveExpression[?Yield] `-` MultiplicativeExpression[?Yield]
+ AdditiveExpression[Yield, Await] :
+ MultiplicativeExpression[?Yield, ?Await]
+ AdditiveExpression[?Yield, ?Await] `+` MultiplicativeExpression[?Yield, ?Await]
+ AdditiveExpression[?Yield, ?Await] `-` MultiplicativeExpression[?Yield, ?Await]
@@ -12910,11 +12959,11 @@ Applying the Additive Operators to Numbers
Bitwise Shift Operators
Syntax
- ShiftExpression[Yield] :
- AdditiveExpression[?Yield]
- ShiftExpression[?Yield] `<<` AdditiveExpression[?Yield]
- ShiftExpression[?Yield] `>>` AdditiveExpression[?Yield]
- ShiftExpression[?Yield] `>>>` AdditiveExpression[?Yield]
+ ShiftExpression[Yield, Await] :
+ AdditiveExpression[?Yield, ?Await]
+ ShiftExpression[?Yield, ?Await] `<<` AdditiveExpression[?Yield, ?Await]
+ ShiftExpression[?Yield, ?Await] `>>` AdditiveExpression[?Yield, ?Await]
+ ShiftExpression[?Yield, ?Await] `>>>` AdditiveExpression[?Yield, ?Await]
@@ -13028,14 +13077,14 @@ Relational Operators
Syntax
- RelationalExpression[In, Yield] :
- ShiftExpression[?Yield]
- RelationalExpression[?In, ?Yield] `<` ShiftExpression[?Yield]
- RelationalExpression[?In, ?Yield] `>` ShiftExpression[?Yield]
- RelationalExpression[?In, ?Yield] `<=` ShiftExpression[?Yield]
- RelationalExpression[?In, ?Yield] `>=` ShiftExpression[?Yield]
- RelationalExpression[?In, ?Yield] `instanceof` ShiftExpression[?Yield]
- [+In] RelationalExpression[+In, ?Yield] `in` ShiftExpression[?Yield]
+ RelationalExpression[In, Yield, Await] :
+ ShiftExpression[?Yield, ?Await]
+ RelationalExpression[?In, ?Yield, ?Await] `<` ShiftExpression[?Yield, ?Await]
+ RelationalExpression[?In, ?Yield, ?Await] `>` ShiftExpression[?Yield, ?Await]
+ RelationalExpression[?In, ?Yield, ?Await] `<=` ShiftExpression[?Yield, ?Await]
+ RelationalExpression[?In, ?Yield, ?Await] `>=` ShiftExpression[?Yield, ?Await]
+ RelationalExpression[?In, ?Yield, ?Await] `instanceof` ShiftExpression[?Yield, ?Await]
+ [+In] RelationalExpression[+In, ?Yield, ?Await] `in` ShiftExpression[?Yield, ?Await]
The [In] grammar parameter is needed to avoid confusing the `in` operator in a relational expression with the `in` operator in a `for` statement.
@@ -13165,12 +13214,12 @@ Equality Operators
Syntax
- EqualityExpression[In, Yield] :
- RelationalExpression[?In, ?Yield]
- EqualityExpression[?In, ?Yield] `==` RelationalExpression[?In, ?Yield]
- EqualityExpression[?In, ?Yield] `!=` RelationalExpression[?In, ?Yield]
- EqualityExpression[?In, ?Yield] `===` RelationalExpression[?In, ?Yield]
- EqualityExpression[?In, ?Yield] `!==` RelationalExpression[?In, ?Yield]
+ EqualityExpression[In, Yield, Await] :
+ RelationalExpression[?In, ?Yield, ?Await]
+ EqualityExpression[?In, ?Yield, ?Await] `==` RelationalExpression[?In, ?Yield, ?Await]
+ EqualityExpression[?In, ?Yield, ?Await] `!=` RelationalExpression[?In, ?Yield, ?Await]
+ EqualityExpression[?In, ?Yield, ?Await] `===` RelationalExpression[?In, ?Yield, ?Await]
+ EqualityExpression[?In, ?Yield, ?Await] `!==` RelationalExpression[?In, ?Yield, ?Await]
@@ -13289,17 +13338,17 @@ Runtime Semantics: Evaluation
Binary Bitwise Operators
Syntax
- BitwiseANDExpression[In, Yield] :
- EqualityExpression[?In, ?Yield]
- BitwiseANDExpression[?In, ?Yield] `&` EqualityExpression[?In, ?Yield]
+ BitwiseANDExpression[In, Yield, Await] :
+ EqualityExpression[?In, ?Yield, ?Await]
+ BitwiseANDExpression[?In, ?Yield, ?Await] `&` EqualityExpression[?In, ?Yield, ?Await]
- BitwiseXORExpression[In, Yield] :
- BitwiseANDExpression[?In, ?Yield]
- BitwiseXORExpression[?In, ?Yield] `^` BitwiseANDExpression[?In, ?Yield]
+ BitwiseXORExpression[In, Yield, Await] :
+ BitwiseANDExpression[?In, ?Yield, ?Await]
+ BitwiseXORExpression[?In, ?Yield, ?Await] `^` BitwiseANDExpression[?In, ?Yield, ?Await]
- BitwiseORExpression[In, Yield] :
- BitwiseXORExpression[?In, ?Yield]
- BitwiseORExpression[?In, ?Yield] `|` BitwiseXORExpression[?In, ?Yield]
+ BitwiseORExpression[In, Yield, Await] :
+ BitwiseXORExpression[?In, ?Yield, ?Await]
+ BitwiseORExpression[?In, ?Yield, ?Await] `|` BitwiseXORExpression[?In, ?Yield, ?Await]
@@ -13355,13 +13404,13 @@ Runtime Semantics: Evaluation
Binary Logical Operators
Syntax
- LogicalANDExpression[In, Yield] :
- BitwiseORExpression[?In, ?Yield]
- LogicalANDExpression[?In, ?Yield] `&&` BitwiseORExpression[?In, ?Yield]
+ LogicalANDExpression[In, Yield, Await] :
+ BitwiseORExpression[?In, ?Yield, ?Await]
+ LogicalANDExpression[?In, ?Yield, ?Await] `&&` BitwiseORExpression[?In, ?Yield, ?Await]
- LogicalORExpression[In, Yield] :
- LogicalANDExpression[?In, ?Yield]
- LogicalORExpression[?In, ?Yield] `||` LogicalANDExpression[?In, ?Yield]
+ LogicalORExpression[In, Yield, Await] :
+ LogicalANDExpression[?In, ?Yield, ?Await]
+ LogicalORExpression[?In, ?Yield, ?Await] `||` LogicalANDExpression[?In, ?Yield, ?Await]
The value produced by a `&&` or `||` operator is not necessarily of type Boolean. The value produced will always be the value of one of the two operand expressions.
@@ -13424,9 +13473,9 @@ Runtime Semantics: Evaluation
Conditional Operator ( `? :` )
Syntax
- ConditionalExpression[In, Yield] :
- LogicalORExpression[?In, ?Yield]
- LogicalORExpression[?In, ?Yield] `?` AssignmentExpression[+In, ?Yield] `:` AssignmentExpression[?In, ?Yield]
+ ConditionalExpression[In, Yield, Await] :
+ LogicalORExpression[?In, ?Yield, ?Await]
+ LogicalORExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[?In, ?Yield, ?Await]
The grammar for a |ConditionalExpression| in ECMAScript is slightly different from that in C and Java, which each allow the second subexpression to be an |Expression| but restrict the third expression to be a |ConditionalExpression|. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the centre expression.
@@ -13474,12 +13523,14 @@ Runtime Semantics: Evaluation
Assignment Operators
Syntax
- AssignmentExpression[In, Yield] :
- ConditionalExpression[?In, ?Yield]
- [+Yield] YieldExpression[?In]
- ArrowFunction[?In, ?Yield]
- LeftHandSideExpression[?Yield] `=` AssignmentExpression[?In, ?Yield] #assignment
- LeftHandSideExpression[?Yield] AssignmentOperator AssignmentExpression[?In, ?Yield]
+ AssignmentExpression[In, Yield, Await] :
+ ConditionalExpression[?In, ?Yield, ?Await]
+ [+Yield] YieldExpression[?In, ?Await]
+ [+Await] AwaitExpression[?Yield]
+ ArrowFunction[?In, ?Yield, ?Await]
+ AsyncArrowFunction[?In, ?Yield, ?Await]
+ LeftHandSideExpression[?Yield, ?Await] `=` AssignmentExpression[?In, ?Yield, ?Await] #assignment
+ LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await]
AssignmentOperator : one of
`*=` `/=` `%=` `+=` `-=` `<<=` `>>=` `>>>=` `&=` `^=` `|=` `**=`
@@ -13509,7 +13560,11 @@ Static Semantics: Early Errors
Static Semantics: IsFunctionDefinition
- AssignmentExpression : ArrowFunction
+
+ AssignmentExpression :
+ ArrowFunction
+ AsyncArrowFunction
+
1. Return *true*.
@@ -13532,6 +13587,7 @@ Static Semantics: IsValidSimpleAssignmentTarget
AssignmentExpression :
YieldExpression
ArrowFunction
+ AsyncArrowFunction
LeftHandSideExpression `=` AssignmentExpression
LeftHandSideExpression AssignmentOperator AssignmentExpression
@@ -13543,7 +13599,7 @@ Static Semantics: IsValidSimpleAssignmentTarget
Runtime Semantics: Evaluation
- AssignmentExpression[In, Yield] : LeftHandSideExpression[?Yield] `=` AssignmentExpression[?In, ?Yield]
+ AssignmentExpression[In, Yield, Await] : LeftHandSideExpression[?Yield, ?Await] `=` AssignmentExpression[?In, ?Yield, ?Await]
1. If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Let _lref_ be the result of evaluating |LeftHandSideExpression|.
@@ -13555,7 +13611,7 @@ Runtime Semantics: Evaluation
1. If _hasNameProperty_ is *false*, perform SetFunctionName(_rval_, GetReferencedName(_lref_)).
1. Perform ? PutValue(_lref_, _rval_).
1. Return _rval_.
- 1. Let _assignmentPattern_ be the parse of the source text corresponding to |LeftHandSideExpression| using |AssignmentPattern[?Yield]| as the goal symbol.
+ 1. Let _assignmentPattern_ be the parse of the source text corresponding to |LeftHandSideExpression| using |AssignmentPattern| as the goal symbol with its [Yield] and [Await] parameters set to the values used when parsing |LeftHandSideExpression|.
1. Let _rref_ be the result of evaluating |AssignmentExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. Let _status_ be the result of performing DestructuringAssignmentEvaluation of _assignmentPattern_ using _rval_ as the argument.
@@ -13584,43 +13640,43 @@ Destructuring Assignment
Supplemental Syntax
In certain circumstances when processing the production AssignmentExpression : LeftHandSideExpression `=` AssignmentExpression the following grammar is used to refine the interpretation of |LeftHandSideExpression|.
- AssignmentPattern[Yield] :
- ObjectAssignmentPattern[?Yield]
- ArrayAssignmentPattern[?Yield]
+ AssignmentPattern[Yield, Await] :
+ ObjectAssignmentPattern[?Yield, ?Await]
+ ArrayAssignmentPattern[?Yield, ?Await]
- ObjectAssignmentPattern[Yield] :
+ ObjectAssignmentPattern[Yield, Await] :
`{` `}`
- `{` AssignmentPropertyList[?Yield] `}`
- `{` AssignmentPropertyList[?Yield] `,` `}`
+ `{` AssignmentPropertyList[?Yield, ?Await] `}`
+ `{` AssignmentPropertyList[?Yield, ?Await] `,` `}`
- ArrayAssignmentPattern[Yield] :
- `[` Elision? AssignmentRestElement[?Yield]? `]`
- `[` AssignmentElementList[?Yield] `]`
- `[` AssignmentElementList[?Yield] `,` Elision? AssignmentRestElement[?Yield]? `]`
+ ArrayAssignmentPattern[Yield, Await] :
+ `[` Elision? AssignmentRestElement[?Yield, ?Await]? `]`
+ `[` AssignmentElementList[?Yield, ?Await] `]`
+ `[` AssignmentElementList[?Yield, ?Await] `,` Elision? AssignmentRestElement[?Yield, ?Await]? `]`
- AssignmentPropertyList[Yield] :
- AssignmentProperty[?Yield]
- AssignmentPropertyList[?Yield] `,` AssignmentProperty[?Yield]
+ AssignmentPropertyList[Yield, Await] :
+ AssignmentProperty[?Yield, ?Await]
+ AssignmentPropertyList[?Yield, ?Await] `,` AssignmentProperty[?Yield, ?Await]
- AssignmentElementList[Yield] :
- AssignmentElisionElement[?Yield]
- AssignmentElementList[?Yield] `,` AssignmentElisionElement[?Yield]
+ AssignmentElementList[Yield, Await] :
+ AssignmentElisionElement[?Yield, ?Await]
+ AssignmentElementList[?Yield, ?Await] `,` AssignmentElisionElement[?Yield, ?Await]
- AssignmentElisionElement[Yield] :
- Elision? AssignmentElement[?Yield]
+ AssignmentElisionElement[Yield, Await] :
+ Elision? AssignmentElement[?Yield, ?Await]
- AssignmentProperty[Yield] :
- IdentifierReference[?Yield] Initializer[+In, ?Yield]?
- PropertyName[?Yield] `:` AssignmentElement[?Yield]
+ AssignmentProperty[Yield, Await] :
+ IdentifierReference[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]?
+ PropertyName[?Yield, ?Await] `:` AssignmentElement[?Yield, ?Await]
- AssignmentElement[Yield] :
- DestructuringAssignmentTarget[?Yield] Initializer[+In, ?Yield]?
+ AssignmentElement[Yield, Await] :
+ DestructuringAssignmentTarget[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]?
- AssignmentRestElement[Yield] :
- `...` DestructuringAssignmentTarget[?Yield]
+ AssignmentRestElement[Yield, Await] :
+ `...` DestructuringAssignmentTarget[?Yield, ?Await]
- DestructuringAssignmentTarget[Yield] :
- LeftHandSideExpression[?Yield]
+ DestructuringAssignmentTarget[Yield, Await] :
+ LeftHandSideExpression[?Yield, ?Await]
@@ -13780,7 +13836,7 @@ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
1. If _next_ is *false*, set _iteratorRecord_.[[Done]] to *true*.
1. Return NormalCompletion(~empty~).
- AssignmentElement[Yield] : DestructuringAssignmentTarget Initializer?
+ AssignmentElement[Yield, Await] : DestructuringAssignmentTarget Initializer?
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Let _lref_ be the result of evaluating |DestructuringAssignmentTarget|.
@@ -13800,7 +13856,7 @@ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
1. Let _v_ be ? GetValue(_defaultValue_).
1. Else, let _v_ be _value_.
1. If |DestructuringAssignmentTarget| is an |ObjectLiteral| or an |ArrayLiteral|, then
- 1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern[~Yield]| or |AssignmentPattern[+Yield]| as the goal symbol depending upon whether this |AssignmentElement| has the [Yield] parameter.
+ 1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using |AssignmentPattern| as the goal symbol with its [Yield] and [Await] parameters set to the values used when parsing this |DestructuringAssignmentTarget|.
1. Return the result of performing DestructuringAssignmentEvaluation of _nestedAssignmentPattern_ with _v_ as the argument.
1. If |Initializer| is present and _value_ is *undefined* and IsAnonymousFunctionDefinition(|Initializer|) and IsIdentifierRef of |DestructuringAssignmentTarget| are both *true*, then
1. Let _hasNameProperty_ be ? HasOwnProperty(_v_, `"name"`).
@@ -13810,7 +13866,7 @@ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
Left to right evaluation order is maintained by evaluating a |DestructuringAssignmentTarget| that is not a destructuring pattern prior to accessing the iterator or evaluating the |Initializer|.
- AssignmentRestElement[Yield] : `...` DestructuringAssignmentTarget
+ AssignmentRestElement[Yield, Await] : `...` DestructuringAssignmentTarget
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Let _lref_ be the result of evaluating |DestructuringAssignmentTarget|.
@@ -13831,7 +13887,7 @@ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
1. Increment _n_ by 1.
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Return ? PutValue(_lref_, _A_).
- 1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern[~Yield]| or |AssignmentPattern[+Yield]| as the goal symbol depending upon whether this |AssignmentRestElement| has the [Yield] parameter.
+ 1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using |AssignmentPattern| as the goal symbol with its [Yield] and [Await] parameters set to the values used when parsing this |AssignmentRestElement|.
1. Return the result of performing DestructuringAssignmentEvaluation of _nestedAssignmentPattern_ with _A_ as the argument.
@@ -13840,7 +13896,7 @@ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
Runtime Semantics: KeyedDestructuringAssignmentEvaluation
with parameters _value_ and _propertyName_
- AssignmentElement[Yield] : DestructuringAssignmentTarget Initializer?
+ AssignmentElement[Yield, Await] : DestructuringAssignmentTarget Initializer?
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Let _lref_ be the result of evaluating |DestructuringAssignmentTarget|.
@@ -13851,7 +13907,7 @@ Runtime Semantics: KeyedDestructuringAssignmentEvaluation
1. Let _rhsValue_ be ? GetValue(_defaultValue_).
1. Else, let _rhsValue_ be _v_.
1. If |DestructuringAssignmentTarget| is an |ObjectLiteral| or an |ArrayLiteral|, then
- 1. Let _assignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern[~Yield]| or |AssignmentPattern[+Yield]| as the goal symbol depending upon whether this |AssignmentElement| has the [Yield] parameter.
+ 1. Let _assignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using |AssignmentPattern| as the goal symbol with its [Yield] and [Await] parameters set to the values used when parsing this |DestructuringAssignmentTarget|.
1. Return the result of performing DestructuringAssignmentEvaluation of _assignmentPattern_ with _rhsValue_ as the argument.
1. If |Initializer| is present and _v_ is *undefined* and IsAnonymousFunctionDefinition(|Initializer|) and IsIdentifierRef of |DestructuringAssignmentTarget| are both *true*, then
1. Let _hasNameProperty_ be ? HasOwnProperty(_rhsValue_, `"name"`).
@@ -13867,9 +13923,9 @@ Runtime Semantics: KeyedDestructuringAssignmentEvaluation
Comma Operator ( `,` )
Syntax
- Expression[In, Yield] :
- AssignmentExpression[?In, ?Yield]
- Expression[?In, ?Yield] `,` AssignmentExpression[?In, ?Yield]
+ Expression[In, Yield, Await] :
+ AssignmentExpression[?In, ?Yield, ?Await]
+ Expression[?In, ?Yield, ?Await] `,` AssignmentExpression[?In, ?Yield, ?Await]
@@ -13914,34 +13970,35 @@ Runtime Semantics: Evaluation
ECMAScript Language: Statements and Declarations
Syntax
- Statement[Yield, Return] :
- BlockStatement[?Yield, ?Return]
- VariableStatement[?Yield]
+ Statement[Yield, Await, Return] :
+ BlockStatement[?Yield, ?Await, ?Return]
+ VariableStatement[?Yield, ?Await]
EmptyStatement
- ExpressionStatement[?Yield]
- IfStatement[?Yield, ?Return]
- BreakableStatement[?Yield, ?Return]
- ContinueStatement[?Yield]
- BreakStatement[?Yield]
- [+Return] ReturnStatement[?Yield]
- WithStatement[?Yield, ?Return]
- LabelledStatement[?Yield, ?Return]
- ThrowStatement[?Yield]
- TryStatement[?Yield, ?Return]
+ ExpressionStatement[?Yield, ?Await]
+ IfStatement[?Yield, ?Await, ?Return]
+ BreakableStatement[?Yield, ?Await, ?Return]
+ ContinueStatement[?Yield, ?Await]
+ BreakStatement[?Yield, ?Await]
+ [+Return] ReturnStatement[?Yield, ?Await]
+ WithStatement[?Yield, ?Await, ?Return]
+ LabelledStatement[?Yield, ?Await, ?Return]
+ ThrowStatement[?Yield, ?Await]
+ TryStatement[?Yield, ?Await, ?Return]
DebuggerStatement
- Declaration[Yield] :
- HoistableDeclaration[?Yield, ~Default]
- ClassDeclaration[?Yield, ~Default]
- LexicalDeclaration[+In, ?Yield]
+ Declaration[Yield, Await] :
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
- HoistableDeclaration[Yield, Default] :
- FunctionDeclaration[?Yield, ?Default]
- GeneratorDeclaration[?Yield, ?Default]
+ HoistableDeclaration[Yield, Await, Default] :
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
- BreakableStatement[Yield, Return] :
- IterationStatement[?Yield, ?Return]
- SwitchStatement[?Yield, ?Return]
+ BreakableStatement[Yield, Await, Return] :
+ IterationStatement[?Yield, ?Await, ?Return]
+ SwitchStatement[?Yield, ?Await, ?Return]
@@ -14025,6 +14082,10 @@ Static Semantics: DeclarationPart
1. Return |GeneratorDeclaration|.
+ HoistableDeclaration : AsyncFunctionDeclaration
+
+ 1. Return |AsyncFunctionDeclaration|.
+
Declaration : ClassDeclaration
1. Return |ClassDeclaration|.
@@ -14105,15 +14166,19 @@ Runtime Semantics: LabelledEvaluation
Runtime Semantics: Evaluation
- HoistableDeclaration :
- GeneratorDeclaration
+ HoistableDeclaration : GeneratorDeclaration
+
+
+ 1. Return NormalCompletion(~empty~).
+
+
+ HoistableDeclaration : AsyncFunctionDeclaration
1. Return NormalCompletion(~empty~).
- HoistableDeclaration :
- FunctionDeclaration
+ HoistableDeclaration : FunctionDeclaration
1. Return the result of evaluating |FunctionDeclaration|.
@@ -14135,19 +14200,19 @@ Runtime Semantics: Evaluation
Block
Syntax
- BlockStatement[Yield, Return] :
- Block[?Yield, ?Return]
+ BlockStatement[Yield, Await, Return] :
+ Block[?Yield, ?Await, ?Return]
- Block[Yield, Return] :
- `{` StatementList[?Yield, ?Return]? `}`
+ Block[Yield, Await, Return] :
+ `{` StatementList[?Yield, ?Await, ?Return]? `}`
- StatementList[Yield, Return] :
- StatementListItem[?Yield, ?Return]
- StatementList[?Yield, ?Return] StatementListItem[?Yield, ?Return]
+ StatementList[Yield, Await, Return] :
+ StatementListItem[?Yield, ?Await, ?Return]
+ StatementList[?Yield, ?Await, ?Return] StatementListItem[?Yield, ?Await, ?Return]
- StatementListItem[Yield, Return] :
- Statement[?Yield, ?Return]
- Declaration[?Yield]
+ StatementListItem[Yield, Await, Return] :
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
@@ -14501,20 +14566,20 @@ Let and Const Declarations
Syntax
- LexicalDeclaration[In, Yield] :
- LetOrConst BindingList[?In, ?Yield] `;`
+ LexicalDeclaration[In, Yield, Await] :
+ LetOrConst BindingList[?In, ?Yield, ?Await] `;`
LetOrConst :
`let`
`const`
- BindingList[In, Yield] :
- LexicalBinding[?In, ?Yield]
- BindingList[?In, ?Yield] `,` LexicalBinding[?In, ?Yield]
+ BindingList[In, Yield, Await] :
+ LexicalBinding[?In, ?Yield, ?Await]
+ BindingList[?In, ?Yield, ?Await] `,` LexicalBinding[?In, ?Yield, ?Await]
- LexicalBinding[In, Yield] :
- BindingIdentifier[?Yield] Initializer[?In, ?Yield]?
- BindingPattern[?Yield] Initializer[?In, ?Yield]
+ LexicalBinding[In, Yield, Await] :
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]?
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
@@ -14631,16 +14696,16 @@ Variable Statement
Syntax
- VariableStatement[Yield] :
- `var` VariableDeclarationList[+In, ?Yield] `;`
+ VariableStatement[Yield, Await] :
+ `var` VariableDeclarationList[+In, ?Yield, ?Await] `;`
- VariableDeclarationList[In, Yield] :
- VariableDeclaration[?In, ?Yield]
- VariableDeclarationList[?In, ?Yield] `,` VariableDeclaration[?In, ?Yield]
+ VariableDeclarationList[In, Yield, Await] :
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] `,` VariableDeclaration[?In, ?Yield, ?Await]
- VariableDeclaration[In, Yield] :
- BindingIdentifier[?Yield] Initializer[?In, ?Yield]?
- BindingPattern[?Yield] Initializer[?In, ?Yield]
+ VariableDeclaration[In, Yield, Await] :
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]?
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
@@ -14736,45 +14801,45 @@ Runtime Semantics: Evaluation
Destructuring Binding Patterns
Syntax
- BindingPattern[Yield] :
- ObjectBindingPattern[?Yield]
- ArrayBindingPattern[?Yield]
+ BindingPattern[Yield, Await] :
+ ObjectBindingPattern[?Yield, ?Await]
+ ArrayBindingPattern[?Yield, ?Await]
- ObjectBindingPattern[Yield] :
+ ObjectBindingPattern[Yield, Await] :
`{` `}`
- `{` BindingPropertyList[?Yield] `}`
- `{` BindingPropertyList[?Yield] `,` `}`
+ `{` BindingPropertyList[?Yield, ?Await] `}`
+ `{` BindingPropertyList[?Yield, ?Await] `,` `}`
- ArrayBindingPattern[Yield] :
- `[` Elision? BindingRestElement[?Yield]? `]`
- `[` BindingElementList[?Yield] `]`
- `[` BindingElementList[?Yield] `,` Elision? BindingRestElement[?Yield]? `]`
+ ArrayBindingPattern[Yield, Await] :
+ `[` Elision? BindingRestElement[?Yield, ?Await]? `]`
+ `[` BindingElementList[?Yield, ?Await] `]`
+ `[` BindingElementList[?Yield, ?Await] `,` Elision? BindingRestElement[?Yield, ?Await]? `]`
- BindingPropertyList[Yield] :
- BindingProperty[?Yield]
- BindingPropertyList[?Yield] `,` BindingProperty[?Yield]
+ BindingPropertyList[Yield, Await] :
+ BindingProperty[?Yield, ?Await]
+ BindingPropertyList[?Yield, ?Await] `,` BindingProperty[?Yield, ?Await]
- BindingElementList[Yield] :
- BindingElisionElement[?Yield]
- BindingElementList[?Yield] `,` BindingElisionElement[?Yield]
+ BindingElementList[Yield, Await] :
+ BindingElisionElement[?Yield, ?Await]
+ BindingElementList[?Yield, ?Await] `,` BindingElisionElement[?Yield, ?Await]
- BindingElisionElement[Yield] :
- Elision? BindingElement[?Yield]
+ BindingElisionElement[Yield, Await] :
+ Elision? BindingElement[?Yield, ?Await]
- BindingProperty[Yield] :
- SingleNameBinding[?Yield]
- PropertyName[?Yield] `:` BindingElement[?Yield]
+ BindingProperty[Yield, Await] :
+ SingleNameBinding[?Yield, ?Await]
+ PropertyName[?Yield, ?Await] `:` BindingElement[?Yield, ?Await]
- BindingElement[Yield] :
- SingleNameBinding[?Yield]
- BindingPattern[?Yield] Initializer[+In, ?Yield]?
+ BindingElement[Yield, Await] :
+ SingleNameBinding[?Yield, ?Await]
+ BindingPattern[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]?
- SingleNameBinding[Yield] :
- BindingIdentifier[?Yield] Initializer[+In, ?Yield]?
+ SingleNameBinding[Yield, Await] :
+ BindingIdentifier[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]?
- BindingRestElement[Yield] :
- `...` BindingIdentifier[?Yield]
- `...` BindingPattern[?Yield]
+ BindingRestElement[Yield, Await] :
+ `...` BindingIdentifier[?Yield, ?Await]
+ `...` BindingPattern[?Yield, ?Await]
@@ -15200,11 +15265,11 @@ Runtime Semantics: Evaluation
Expression Statement
Syntax
- ExpressionStatement[Yield] :
- [lookahead <! {`{`, `function`, `class`, `let [`}] Expression[+In, ?Yield] `;`
+ ExpressionStatement[Yield, Await] :
+ [lookahead <! {`{`, `function`, `async` [no |LineTerminator| here] `function`, `class`, `let [`}] Expression[+In, ?Yield, ?Await] `;`
- An |ExpressionStatement| cannot start with a U+007B (LEFT CURLY BRACKET) because that might make it ambiguous with a |Block|. Also, an |ExpressionStatement| cannot start with the `function` or `class` keywords because that would make it ambiguous with a |FunctionDeclaration|, a |GeneratorDeclaration|, or a |ClassDeclaration|. An |ExpressionStatement| cannot start with the two token sequence `let [` because that would make it ambiguous with a `let` |LexicalDeclaration| whose first |LexicalBinding| was an |ArrayBindingPattern|.
+ An |ExpressionStatement| cannot start with a U+007B (LEFT CURLY BRACKET) because that might make it ambiguous with a |Block|. An |ExpressionStatement| cannot start with the `function` or `class` keywords because that would make it ambiguous with a |FunctionDeclaration|, a |GeneratorDeclaration|, or a |ClassDeclaration|. An |ExpressionStatement| cannot start with `async function` because that would make it ambiguous with an |AsyncFunctionExpression|. An |ExpressionStatement| cannot start with the two token sequence `let [` because that would make it ambiguous with a `let` |LexicalDeclaration| whose first |LexicalBinding| was an |ArrayBindingPattern|.
@@ -15223,9 +15288,9 @@ Runtime Semantics: Evaluation
The `if` Statement
Syntax
- IfStatement[Yield, Return] :
- `if` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return] `else` Statement[?Yield, ?Return]
- `if` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ IfStatement[Yield, Await, Return] :
+ `if` `(` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `else` Statement[?Yield, ?Await, ?Return]
+ `if` `(` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
Each `else` for which the choice of associated `if` is ambiguous shall be associated with the nearest possible `if` that would otherwise have no corresponding `else`.
@@ -15361,25 +15426,25 @@ Runtime Semantics: Evaluation
Iteration Statements
Syntax
- IterationStatement[Yield, Return] :
- `do` Statement[?Yield, ?Return] `while` `(` Expression[+In, ?Yield] `)` `;`
- `while` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` [lookahead <! {`let [`}] Expression[~In, ?Yield]? `;` Expression[+In, ?Yield]? `;` Expression[+In, ?Yield]? `)` Statement[?Yield, ?Return]
- `for` `(` `var` VariableDeclarationList[~In, ?Yield] `;` Expression[+In, ?Yield]? `;` Expression[+In, ?Yield]? `)` Statement[?Yield, ?Return]
- `for` `(` LexicalDeclaration[~In, ?Yield] Expression[+In, ?Yield]? `;` Expression[+In, ?Yield]? `)` Statement[?Yield, ?Return]
- `for` `(` [lookahead <! {`let [`}] LeftHandSideExpression[?Yield] `in` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` `var` ForBinding[?Yield] `in` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` ForDeclaration[?Yield] `in` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` [lookahead != `let` ] LeftHandSideExpression[?Yield] `of` AssignmentExpression[+In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` `var` ForBinding[?Yield] `of` AssignmentExpression[+In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` ForDeclaration[?Yield] `of` AssignmentExpression[+In, ?Yield] `)` Statement[?Yield, ?Return]
-
- ForDeclaration[Yield] :
- LetOrConst ForBinding[?Yield]
-
- ForBinding[Yield] :
- BindingIdentifier[?Yield]
- BindingPattern[?Yield]
+ IterationStatement[Yield, Await, Return] :
+ `do` Statement[?Yield, ?Await, ?Return] `while` `(` Expression[+In, ?Yield, ?Await] `)` `;`
+ `while` `(` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` [lookahead <! {`let [`}] Expression[~In, ?Yield, ?Await]? `;` Expression[+In, ?Yield, ?Await]? `;` Expression[+In, ?Yield, ?Await]? `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` `var` VariableDeclarationList[~In, ?Yield, ?Await] `;` Expression[+In, ?Yield, ?Await]? `;` Expression[+In, ?Yield, ?Await]? `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]? `;` Expression[+In, ?Yield, ?Await]? `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` [lookahead <! {`let [`}] LeftHandSideExpression[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` `var` ForBinding[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` ForDeclaration[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` [lookahead != `let` ] LeftHandSideExpression[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` `var` ForBinding[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
+ `for` `(` ForDeclaration[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
+
+ ForDeclaration[Yield, Await] :
+ LetOrConst ForBinding[?Yield, ?Await]
+
+ ForBinding[Yield, Await] :
+ BindingIdentifier[?Yield, ?Await]
+ BindingPattern[?Yield, ?Await]
This section is extended by Annex .
@@ -16194,9 +16259,9 @@ EnumerateObjectProperties (_O_)
The `continue` Statement
Syntax
- ContinueStatement[Yield] :
+ ContinueStatement[Yield, Await] :
`continue` `;`
- `continue` [no LineTerminator here] LabelIdentifier[?Yield] `;`
+ `continue` [no LineTerminator here] LabelIdentifier[?Yield, ?Await] `;`
@@ -16250,9 +16315,9 @@ Runtime Semantics: Evaluation
The `break` Statement
Syntax
- BreakStatement[Yield] :
+ BreakStatement[Yield, Await] :
`break` `;`
- `break` [no LineTerminator here] LabelIdentifier[?Yield] `;`
+ `break` [no LineTerminator here] LabelIdentifier[?Yield, ?Await] `;`
@@ -16302,9 +16367,9 @@ Runtime Semantics: Evaluation
The `return` Statement
Syntax
- ReturnStatement[Yield] :
+ ReturnStatement[Yield, Await] :
`return` `;`
- `return` [no LineTerminator here] Expression[+In, ?Yield] `;`
+ `return` [no LineTerminator here] Expression[+In, ?Yield, ?Await] `;`
A `return` statement causes a function to cease execution and return a value to the caller. If |Expression| is omitted, the return value is *undefined*. Otherwise, the return value is the value of |Expression|.
@@ -16331,8 +16396,8 @@ Runtime Semantics: Evaluation
The `with` Statement
Syntax
- WithStatement[Yield, Return] :
- `with` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ WithStatement[Yield, Await, Return] :
+ `with` `(` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
The `with` statement adds an object Environment Record for a computed object to the lexical environment of the running execution context. It then executes a statement using this augmented lexical environment. Finally, it restores the original lexical environment.
@@ -16434,22 +16499,22 @@ Runtime Semantics: Evaluation
The `switch` Statement
Syntax
- SwitchStatement[Yield, Return] :
- `switch` `(` Expression[+In, ?Yield] `)` CaseBlock[?Yield, ?Return]
+ SwitchStatement[Yield, Await, Return] :
+ `switch` `(` Expression[+In, ?Yield, ?Await] `)` CaseBlock[?Yield, ?Await, ?Return]
- CaseBlock[Yield, Return] :
- `{` CaseClauses[?Yield, ?Return]? `}`
- `{` CaseClauses[?Yield, ?Return]? DefaultClause[?Yield, ?Return] CaseClauses[?Yield, ?Return]? `}`
+ CaseBlock[Yield, Await, Return] :
+ `{` CaseClauses[?Yield, ?Await, ?Return]? `}`
+ `{` CaseClauses[?Yield, ?Await, ?Return]? DefaultClause[?Yield, ?Await, ?Return] CaseClauses[?Yield, ?Await, ?Return]? `}`
- CaseClauses[Yield, Return] :
- CaseClause[?Yield, ?Return]
- CaseClauses[?Yield, ?Return] CaseClause[?Yield, ?Return]
+ CaseClauses[Yield, Await, Return] :
+ CaseClause[?Yield, ?Await, ?Return]
+ CaseClauses[?Yield, ?Await, ?Return] CaseClause[?Yield, ?Await, ?Return]
- CaseClause[Yield, Return] :
- `case` Expression[+In, ?Yield] `:` StatementList[?Yield, ?Return]?
+ CaseClause[Yield, Await, Return] :
+ `case` Expression[+In, ?Yield, ?Await] `:` StatementList[?Yield, ?Await, ?Return]?
- DefaultClause[Yield, Return] :
- `default` `:` StatementList[?Yield, ?Return]?
+ DefaultClause[Yield, Await, Return] :
+ `default` `:` StatementList[?Yield, ?Await, ?Return]?
@@ -16850,12 +16915,12 @@ Runtime Semantics: Evaluation
Labelled Statements
Syntax
- LabelledStatement[Yield, Return] :
- LabelIdentifier[?Yield] `:` LabelledItem[?Yield, ?Return]
+ LabelledStatement[Yield, Await, Return] :
+ LabelIdentifier[?Yield, ?Await] `:` LabelledItem[?Yield, ?Await, ?Return]
- LabelledItem[Yield, Return] :
- Statement[?Yield, ?Return]
- FunctionDeclaration[?Yield, ~Default]
+ LabelledItem[Yield, Await, Return] :
+ Statement[?Yield, ?Await, ?Return]
+ FunctionDeclaration[?Yield, ?Await, ~Default]
A |Statement| may be prefixed by a label. Labelled statements are only used in conjunction with labelled `break` and `continue` statements. ECMAScript has no `goto` statement. A |Statement| can be part of a |LabelledStatement|, which itself can be part of a |LabelledStatement|, and so on. The labels introduced this way are collectively referred to as the “current label set” when describing the semantics of individual statements.
@@ -17105,8 +17170,8 @@ Runtime Semantics: Evaluation
The `throw` Statement
Syntax
- ThrowStatement[Yield] :
- `throw` [no LineTerminator here] Expression[+In, ?Yield] `;`
+ ThrowStatement[Yield, Await] :
+ `throw` [no LineTerminator here] Expression[+In, ?Yield, ?Await] `;`
@@ -17126,20 +17191,20 @@ Runtime Semantics: Evaluation
The `try` Statement
Syntax
- TryStatement[Yield, Return] :
- `try` Block[?Yield, ?Return] Catch[?Yield, ?Return]
- `try` Block[?Yield, ?Return] Finally[?Yield, ?Return]
- `try` Block[?Yield, ?Return] Catch[?Yield, ?Return] Finally[?Yield, ?Return]
+ TryStatement[Yield, Await, Return] :
+ `try` Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ `try` Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ `try` Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
- Catch[Yield, Return] :
- `catch` `(` CatchParameter[?Yield] `)` Block[?Yield, ?Return]
+ Catch[Yield, Await, Return] :
+ `catch` `(` CatchParameter[?Yield, ?Await] `)` Block[?Yield, ?Await, ?Return]
- Finally[Yield, Return] :
- `finally` Block[?Yield, ?Return]
+ Finally[Yield, Await, Return] :
+ `finally` Block[?Yield, ?Await, ?Return]
- CatchParameter[Yield] :
- BindingIdentifier[?Yield]
- BindingPattern[?Yield]
+ CatchParameter[Yield, Await] :
+ BindingIdentifier[?Yield, ?Await]
+ BindingPattern[?Yield, ?Await]
The `try` statement encloses a block of code in which an exceptional condition can occur, such as a runtime error or a `throw` statement. The `catch` clause provides the exception-handling code. When a catch clause catches an exception, its |CatchParameter| is bound to that exception.
@@ -17410,38 +17475,38 @@ ECMAScript Language: Functions and Classes
Function Definitions
Syntax
- FunctionDeclaration[Yield, Default] :
- `function` BindingIdentifier[?Yield] `(` FormalParameters[~Yield] `)` `{` FunctionBody[~Yield] `}`
- [+Default] `function` `(` FormalParameters[~Yield] `)` `{` FunctionBody[~Yield] `}`
+ FunctionDeclaration[Yield, Await, Default] :
+ `function` BindingIdentifier[?Yield, ?Await] `(` FormalParameters[~Yield, ~Await] `)` `{` FunctionBody[~Yield, ~Await] `}`
+ [+Default] `function` `(` FormalParameters[~Yield, ~Await] `)` `{` FunctionBody[~Yield, ~Await] `}`
FunctionExpression :
- `function` BindingIdentifier[~Yield]? `(` FormalParameters[~Yield] `)` `{` FunctionBody[~Yield] `}`
+ `function` BindingIdentifier[~Yield, ~Await]? `(` FormalParameters[~Yield, ~Await] `)` `{` FunctionBody[~Yield, ~Await] `}`
- UniqueFormalParameters[Yield] :
- FormalParameters[?Yield]
+ UniqueFormalParameters[Yield, Await] :
+ FormalParameters[?Yield, ?Await]
- FormalParameters[Yield] :
+ FormalParameters[Yield, Await] :
[empty]
- FunctionRestParameter[?Yield]
- FormalParameterList[?Yield]
- FormalParameterList[?Yield] `,`
- FormalParameterList[?Yield] `,` FunctionRestParameter[?Yield]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] `,`
+ FormalParameterList[?Yield, ?Await] `,` FunctionRestParameter[?Yield, ?Await]
- FormalParameterList[Yield] :
- FormalParameter[?Yield]
- FormalParameterList[?Yield] `,` FormalParameter[?Yield]
+ FormalParameterList[Yield, Await] :
+ FormalParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] `,` FormalParameter[?Yield, ?Await]
- FunctionRestParameter[Yield] :
- BindingRestElement[?Yield]
+ FunctionRestParameter[Yield, Await] :
+ BindingRestElement[?Yield, ?Await]
- FormalParameter[Yield] :
- BindingElement[?Yield]
+ FormalParameter[Yield, Await] :
+ BindingElement[?Yield, ?Await]
- FunctionBody[Yield] :
- FunctionStatementList[?Yield]
+ FunctionBody[Yield, Await] :
+ FunctionStatementList[?Yield, ?Await]
- FunctionStatementList[Yield] :
- StatementList[?Yield, +Return]?
+ FunctionStatementList[Yield, Await] :
+ StatementList[?Yield, ?Await, +Return]?
@@ -17777,10 +17842,11 @@ Static Semantics: VarScopedDeclarations
Runtime Semantics: EvaluateBody
- With parameter _functionObject_.
+ With parameter _functionObject_ and List _argumentsList_.
FunctionBody : FunctionStatementList
+ 1. Perform ? FunctionDeclarationInstantiation(_functionObject_, _argumentsList_).
1. Return the result of evaluating |FunctionStatementList|.
@@ -17927,26 +17993,26 @@ Runtime Semantics: Evaluation
Arrow Function Definitions
Syntax
- ArrowFunction[In, Yield] :
- ArrowParameters[?Yield] [no LineTerminator here] `=>` ConciseBody[?In]
+ ArrowFunction[In, Yield, Await] :
+ ArrowParameters[?Yield, ?Await] [no LineTerminator here] `=>` ConciseBody[?In]
- ArrowParameters[Yield] :
- BindingIdentifier[?Yield]
- CoverParenthesizedExpressionAndArrowParameterList[?Yield] #parencover
+ ArrowParameters[Yield, Await] :
+ BindingIdentifier[?Yield, ?Await]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] #parencover
ConciseBody[In] :
- [lookahead != `{` ] AssignmentExpression[?In, ~Yield]
- `{` FunctionBody[~Yield] `}`
+ [lookahead != `{` ] AssignmentExpression[?In, ~Yield, ~Await]
+ `{` FunctionBody[~Yield, ~Await] `}`
Supplemental Syntax
When the production
- ArrowParameters[Yield] : CoverParenthesizedExpressionAndArrowParameterList[?Yield]
+ ArrowParameters[Yield, Await] : CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
is recognized the following grammar is used to refine the interpretation of |CoverParenthesizedExpressionAndArrowParameterList|:
- ArrowFormalParameters[Yield] :
- `(` UniqueFormalParameters[?Yield] `)`
+ ArrowFormalParameters[Yield, Await] :
+ `(` UniqueFormalParameters[?Yield, ?Await] `)`
@@ -17957,6 +18023,9 @@ Static Semantics: Early Errors
It is a Syntax Error if |ArrowParameters| Contains |YieldExpression| is *true*.
+
+ It is a Syntax Error if |ArrowParameters| Contains |AwaitExpression| is *true*.
+
It is a Syntax Error if ContainsUseStrict of |ConciseBody| is *true* and IsSimpleParameterList of |ArrowParameters| is *false*.
@@ -17964,16 +18033,13 @@ Static Semantics: Early Errors
It is a Syntax Error if any element of the BoundNames of |ArrowParameters| also occurs in the LexicallyDeclaredNames of |ConciseBody|.
- ArrowParameters[Yield] : CoverParenthesizedExpressionAndArrowParameterList[?Yield]
+ ArrowParameters[Yield, Await] : CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
-
- If the [Yield] grammar parameter is present on |ArrowParameters|, it is a Syntax Error if the lexical token sequence matched by |CoverParenthesizedExpressionAndArrowParameterList[?Yield]| cannot be parsed with no tokens left over using |ArrowFormalParameters[+Yield]| as the goal symbol.
-
- -
- If the [Yield] grammar parameter is not present on |ArrowParameters|, it is a Syntax Error if the lexical token sequence matched by |CoverParenthesizedExpressionAndArrowParameterList[?Yield]| cannot be parsed with no tokens left over using |ArrowFormalParameters[~Yield]| as the goal symbol.
+ It is a Syntax Error if the lexical token sequence matched by |CoverParenthesizedExpressionAndArrowParameterList| cannot be parsed with no tokens left over using |ArrowFormalParameters| as the goal symbol with its [Yield] and [Await] parameters set to the values used when parsing this |CoverParenthesizedExpressionAndArrowParameterList|.
-
- All early errors rules for |ArrowFormalParameters| and its derived productions also apply to CoveredFormalsList of |CoverParenthesizedExpressionAndArrowParameterList[?Yield]|.
+ All early errors rules for |ArrowFormalParameters| and its derived productions also apply to CoveredFormalsList of |CoverParenthesizedExpressionAndArrowParameterList|.
@@ -18072,7 +18138,7 @@ Static Semantics: CoveredFormalsList
1. Return this |ArrowParameters|.
- CoverParenthesizedExpressionAndArrowParameterList[Yield] :
+ CoverParenthesizedExpressionAndArrowParameterList[Yield, Await] :
`(` Expression `)`
`(` `)`
`(` `...` BindingIdentifier `)`
@@ -18081,8 +18147,7 @@ Static Semantics: CoveredFormalsList
`(` Expression `,` `...` BindingPattern `)`
- 1. If the [Yield] grammar parameter is present for |CoverParenthesizedExpressionAndArrowParameterList[Yield]|, return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList[Yield]| using |ArrowFormalParameters[+Yield]| as the goal symbol.
- 1. If the [Yield] grammar parameter is not present for |CoverParenthesizedExpressionAndArrowParameterList[Yield]|, return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList[Yield]| using |ArrowFormalParameters[~Yield]| as the goal symbol.
+ 1. Return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList| using |ArrowFormalParameters| as the goal symbol with its [Yield] and [Await] parameters set to the values used when parsing this |CoverParenthesizedExpressionAndArrowParameterList|.
@@ -18153,10 +18218,11 @@ Runtime Semantics: IteratorBindingInitialization
Runtime Semantics: EvaluateBody
- With parameter _functionObject_.
+ With parameter _functionObject_ and List _argumentsList_.
ConciseBody : AssignmentExpression
+ 1. Perform ? FunctionDeclarationInstantiation(_functionObject_, _argumentsList_).
1. Let _exprRef_ be the result of evaluating |AssignmentExpression|.
1. Let _exprValue_ be ? GetValue(_exprRef_).
1. Return Completion{[[Type]]: ~return~, [[Value]]: _exprValue_, [[Target]]: ~empty~}.
@@ -18185,14 +18251,15 @@ Runtime Semantics: Evaluation
Method Definitions
Syntax
- MethodDefinition[Yield] :
- PropertyName[?Yield] `(` UniqueFormalParameters[~Yield] `)` `{` FunctionBody[~Yield] `}`
- GeneratorMethod[?Yield]
- `get` PropertyName[?Yield] `(` `)` `{` FunctionBody[~Yield] `}`
- `set` PropertyName[?Yield] `(` PropertySetParameterList `)` `{` FunctionBody[~Yield] `}`
+ MethodDefinition[Yield, Await] :
+ PropertyName[?Yield, ?Await] `(` UniqueFormalParameters[~Yield, ~Await] `)` `{` FunctionBody[~Yield, ~Await] `}`
+ GeneratorMethod[?Yield, ?Await]
+ AsyncMethod[?Yield, ?Await]
+ `get` PropertyName[?Yield, ?Await] `(` `)` `{` FunctionBody[~Yield, ~Await] `}`
+ `set` PropertyName[?Yield, ?Await] `(` PropertySetParameterList `)` `{` FunctionBody[~Yield, ~Await] `}`
PropertySetParameterList :
- FormalParameter[~Yield]
+ FormalParameter[~Yield, ~Await]
@@ -18366,23 +18433,23 @@ Runtime Semantics: PropertyDefinitionEvaluation
Generator Function Definitions
Syntax
- GeneratorMethod[Yield] :
- `*` PropertyName[?Yield] `(` UniqueFormalParameters[+Yield] `)` `{` GeneratorBody `}`
+ GeneratorMethod[Yield, Await] :
+ `*` PropertyName[?Yield, ?Await] `(` UniqueFormalParameters[+Yield, ?Await] `)` `{` GeneratorBody `}`
- GeneratorDeclaration[Yield, Default] :
- `function` `*` BindingIdentifier[?Yield] `(` FormalParameters[+Yield] `)` `{` GeneratorBody `}`
- [+Default] `function` `*` `(` FormalParameters[+Yield] `)` `{` GeneratorBody `}`
+ GeneratorDeclaration[Yield, Await, Default] :
+ `function` `*` BindingIdentifier[?Yield, ?Await] `(` FormalParameters[+Yield, ?Await] `)` `{` GeneratorBody `}`
+ [+Default] `function` `*` `(` FormalParameters[+Yield, ?Await] `)` `{` GeneratorBody `}`
GeneratorExpression :
- `function` `*` BindingIdentifier[+Yield]? `(` FormalParameters[+Yield] `)` `{` GeneratorBody `}`
+ `function` `*` BindingIdentifier[+Yield, ~Await]? `(` FormalParameters[+Yield, ~Await] `)` `{` GeneratorBody `}`
GeneratorBody :
- FunctionBody[+Yield]
+ FunctionBody[+Yield, ~Await]
- YieldExpression[In] :
+ YieldExpression[In, Await] :
`yield`
- `yield` [no LineTerminator here] AssignmentExpression[?In, +Yield]
- `yield` [no LineTerminator here] `*` AssignmentExpression[?In, +Yield]
+ `yield` [no LineTerminator here] AssignmentExpression[?In, +Yield, ?Await]
+ `yield` [no LineTerminator here] `*` AssignmentExpression[?In, +Yield, ?Await]
The syntactic context immediately following `yield` requires use of the |InputElementRegExpOrTemplateTail| lexical goal.
@@ -18560,10 +18627,11 @@ Static Semantics: PropName
Runtime Semantics: EvaluateBody
- With parameter _functionObject_.
+ With parameter _functionObject_ and List _argumentsList_.
GeneratorBody : FunctionBody
+ 1. Perform ? FunctionDeclarationInstantiation(_functionObject_, _argumentsList_).
1. Let _G_ be ? OrdinaryCreateFromConstructor(_functionObject_, `"%GeneratorPrototype%"`, « [[GeneratorState]], [[GeneratorContext]] »).
1. Perform GeneratorStart(_G_, |FunctionBody|).
1. Return Completion{[[Type]]: ~return~, [[Value]]: _G_, [[Target]]: ~empty~}.
@@ -18707,29 +18775,29 @@ Runtime Semantics: Evaluation
Class Definitions
Syntax
- ClassDeclaration[Yield, Default] :
- `class` BindingIdentifier[?Yield] ClassTail[?Yield]
- [+Default] `class` ClassTail[?Yield]
+ ClassDeclaration[Yield, Await, Default] :
+ `class` BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] `class` ClassTail[?Yield, ?Await]
- ClassExpression[Yield] :
- `class` BindingIdentifier[?Yield]? ClassTail[?Yield]
+ ClassExpression[Yield, Await] :
+ `class` BindingIdentifier[?Yield, ?Await]? ClassTail[?Yield, ?Await]
- ClassTail[Yield] :
- ClassHeritage[?Yield]? `{` ClassBody[?Yield]? `}`
+ ClassTail[Yield, Await] :
+ ClassHeritage[?Yield, ?Await]? `{` ClassBody[?Yield, ?Await]? `}`
- ClassHeritage[Yield] :
- `extends` LeftHandSideExpression[?Yield]
+ ClassHeritage[Yield, Await] :
+ `extends` LeftHandSideExpression[?Yield, ?Await]
- ClassBody[Yield] :
- ClassElementList[?Yield]
+ ClassBody[Yield, Await] :
+ ClassElementList[?Yield, ?Await]
- ClassElementList[Yield] :
- ClassElement[?Yield]
- ClassElementList[?Yield] ClassElement[?Yield]
+ ClassElementList[Yield, Await] :
+ ClassElement[?Yield, ?Await]
+ ClassElementList[?Yield, ?Await] ClassElement[?Yield, ?Await]
- ClassElement[Yield] :
- MethodDefinition[?Yield]
- `static` MethodDefinition[?Yield]
+ ClassElement[Yield, Await] :
+ MethodDefinition[?Yield, ?Await]
+ `static` MethodDefinition[?Yield, ?Await]
`;`
@@ -18995,11 +19063,11 @@ Runtime Semantics: ClassDefinitionEvaluation
1. If |ClassHeritage_opt| is present and _protoParent_ is not *null*, then
1. Let _constructor_ be the result of parsing the source text
constructor(... args){ super (...args);}
- using the syntactic grammar with the goal symbol |MethodDefinition[~Yield]|.
+ using the syntactic grammar with the goal symbol |MethodDefinition[~Yield, ~Await]|.
1. Else,
1. Let _constructor_ be the result of parsing the source text
constructor( ){ }
- using the syntactic grammar with the goal symbol |MethodDefinition[~Yield]|.
+ using the syntactic grammar with the goal symbol |MethodDefinition[~Yield, ~Await]|.
1. Set the running execution context's LexicalEnvironment to _classScope_.
1. Let _constructorInfo_ be the result of performing DefineMethod for _constructor_ with arguments _proto_ and _constructorParent_ as the optional _functionPrototype_ argument.
1. Assert: _constructorInfo_ is not an abrupt completion.
@@ -19078,6 +19146,546 @@ Runtime Semantics: Evaluation
+
+ Async Function Definitions
+ Syntax
+
+ AsyncFunctionDeclaration[Yield, Await, Default] :
+ `async` [no LineTerminator here] `function` BindingIdentifier[?Yield, ?Await] `(` FormalParameters[?Yield, ?Await] `)` `{` AsyncFunctionBody `}`
+ [+Default] `async` [no LineTerminator here] `function` `(` FormalParameters[?Yield, ?Await] `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionExpression :
+ `async` [no LineTerminator here] `function` `(` FormalParameters[~Yield, +Await] `)` `{` AsyncFunctionBody `}`
+ `async` [no LineTerminator here] `function` BindingIdentifier[~Yield, +Await] `(` FormalParameters[~Yield, +Await] `)` `{` AsyncFunctionBody `}`
+
+ AsyncMethod[Yield, Await] :
+ `async` [no LineTerminator here] PropertyName[?Yield, ?Await] `(` UniqueFormalParameters[?Yield, +Await] `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionBody :
+ FunctionBody[~Yield, +Await]
+
+ AwaitExpression[Yield] :
+ `await` UnaryExpression[?Yield, +Await]
+
+
+
+ `await` is parsed as an |AwaitExpression| when the [Await] parameter in present. The await parameter is present in the following contexts:
+
+ - In an |AsyncFunctionBody|.
+ - In the |FormalParameters| of an |AsyncFunctionDeclaration| and |AsyncFunctionExpression|. |AwaitExpression| in this position is a syntax error via static semantics.
+
+ When |Module| is the syntatic goal symbol and the [Await] parameter is absent, `await` is parsed as a keyword and will be a syntax error. When |Script| is the syntactic goal symbol, `await` may be parsed as an identifier when the [Await] parameter is absent. This includes the following contexts:
+
+ - Anywhere outside of an |AsyncFunctionBody| or |FormalParameters| of an |AsyncFunctionDeclaration| or |AsyncFunctionExpression|.
+ - In the |BindingIdentifier| of a |FunctionExpression| or |GeneratorExpression|.
+
+
+
+
+ Unlike |YieldExpression|, it is a Syntax Error to omit the operand of an |AwaitExpression|. You must await something.
+
+
+
+ Static Semantics: Early Errors
+
+ AsyncMethod : `async` [no LineTerminator here] PropertyName `(` UniqueFormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ - It is a Syntax Error if ContainsUseStrict of |AsyncFunctionBody| is *true* and IsSimpleParameterList of |UniqueFormalParameters| is *false*.
+ - It is a Syntax Error if HasDirectSuper of |AsyncMethod| is *true*.
+ - It is a Syntax Error if |UniqueFormalParameters| Contains |AwaitExpression| is *true*.
+ - It is a Syntax Error if any element of the BoundNames of |UniqueFormalParameters| also occurs in the LexicallyDeclaredNames of |AsyncFunctionBody|
+
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ - It is a Syntax Error if ContainsUseStrict of |AsyncFunctionBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*.
+ - It is a Syntax Error if |FormalParameters| Contains |AwaitExpression| is *true*.
+ - If the source code matching this production is strict code, the Early Error rules for |UniqueFormalParameters| : |FormalParameters| are applied.
+ - If the source code matching this production is strict code, it is a Syntax Error if |BindingIdentifier| is the |IdentifierName| `eval` or the |IdentifierName| `arguments`.
+ - It is a Syntax Error if any element of the BoundNames of |FormalParameters| also occurs in the LexicallyDeclaredNames of |AsyncFunctionBody|.
+ - It is a Syntax Error if |FormalParameters| contains |SuperProperty| is *true*.
+ - It is a Syntax Error if |AsyncFunctionBody| contains |SuperProperty| is *true*.
+ - It is a Syntax Error if |FormalParameters| contains |SuperCall| is *true*.
+ - It is a Syntax Error if |AsyncFunctionBody| contains |SuperCall| is *true*.
+
+
+
+
+ Static Semantics: BoundNames
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return the BoundNames of |BindingIdentifier|.
+
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return «`"*default*"`».
+
+ "`*default*`" is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.
+
+
+
+ Static Semantics: ComputedPropertyContains
+ With parameter _symbol_.
+
+ AsyncMethod : `async` [no LineTerminator here] PropertyName `(` UniqueFormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return the result of ComputedPropertyContains for |PropertyName| with argument _symbol_.
+
+
+
+
+ Static Semantics: Contains
+ With parameter _symbol_.
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return *false*.
+
+
+
+
+ Static Semantics: HasDirectSuper
+
+ AsyncMethod : `async` [no LineTerminator here] PropertyName `(` UniqueFormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. If |UniqueFormalParameters| Contains |SuperCall| is *true*, return *true*.
+ 2. Return |AsyncFunctionBody| Contains |SuperCall|.
+
+
+
+
+ Static Semantics: HasName
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return *false*.
+
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return *true*.
+
+
+
+
+ Static Semantics: IsConstantDeclaration
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return *false*.
+
+
+
+
+ Static Semantics: IsFunctionDefinition
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return *true*.
+
+
+
+
+ Static Semantics: PropName
+
+ AsyncMethod : `async` [no LineTerminator here] PropertyName `(` UniqueFormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return PropName of |PropertyName|.
+
+
+
+
+ Runtime Semantics: InstantiateFunctionObject
+ With parameter _scope_.
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. If the function code for |AsyncFunctionDeclaration| is strict mode code, let _strict_ be *true*. Otherwise, let _strict_ be *false*.
+ 2. Let _name_ be StringValue of |BindingIdentifier|.
+ 3. Let _F_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _scope_, _strict_).
+ 4. Perform ! SetFunctionName(_F_, _name_).
+ 1. Set _F_.[[SourceText]] to the source text matched by |AsyncFunctionDeclaration|.
+ 5. Return _F_.
+
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. If the function code for |AsyncFunctionDeclaration| is strict mode code, let _strict_ be *true*. Otherwise, let _strict_ be *false*.
+ 2. Let _F_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _scope_, _strict_).
+ 3. Perform ! SetFunctionName(_F_, `"default"`).
+ 1. Set _F_.[[SourceText]] to the source text matched by |AsyncFunctionDeclaration|.
+ 4. Return _F_.
+
+
+
+
+ Runtime Semantics: EvaluateBody
+ With parameters _functionObject_ and List _argumentsList_.
+
+ AsyncFunctionBody : FunctionBody
+
+
+ 1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
+ 1. Let _declResult_ be FunctionDeclarationInstantiation(_functionObject_, _argumentsList_).
+ 1. If _declResult_ is not an abrupt completion, then
+ 1. Perform ! AsyncFunctionStart(_promiseCapability_, _FunctionBody_).
+ 1. Else _declResult_ is an abrupt completion,
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, «_declResult_.[[value]]»).
+ 1. Return Completion{[[type]]: ~return~, [[value]]: _promiseCapability_.[[Promise]], [[target]]: ~empty~}.
+
+
+
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+ With parameters _object_ and _enumerable_.
+
+ AsyncMethod : `async` [no LineTerminator here] PropertyName `(` UniqueFormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Let _propKey_ be the result of evaluating |PropertyName|.
+ 1. ReturnIfAbrupt(_propKey_).
+ 1. If the function code for this |AsyncMethod| is strict mode code, let _strict_ be *true*. Otherwise let _strict_ be *false*.
+ 1. Let _scope_ be the LexicalEnvironment of the running execution context.
+ 1. Let _closure_ be ! AsyncFunctionCreate(~Method~, |UniqueFormalParameters|, |AsyncFunctionBody|, _scope_, _strict_).
+ 1. Perform ! MakeMethod(_closure_, _object_).
+ 1. Perform ! SetFunctionName(_closure_, _propKey_).
+ 1. Set _closure_.[[SourceText]] to the source text matched by |AsyncMethod|.
+ 1. Let _desc_ be the PropertyDescriptor{[[Value]]: _closure_, [[Writable]]: *true*, [[Enumerable]]: _enumerable_, [[Configurable]]: *true*}.
+ 1. Return ? DefinePropertyOrThrow(_object_, _propKey_, _desc_).
+
+
+
+ Runtime Semantics: Evaluation
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return NormalCompletion(~empty~).
+
+
+
+ AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. Return NormalCompletion(~empty~).
+
+
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. If the function code for |AsyncFunctionExpression| is strict mode code, let _strict_ be *true*. Otherwise let _strict_ be *false*.
+ 1. Let _scope_ be the LexicalEnvironment of the running execution context.
+ 1. Let _closure_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _scope_, _strict_).
+ 1. Set _closure_.[[SourceText]] to the source text matched by |AsyncFunctionExpression|.
+ 1. Return _closure_.
+
+
+
+ AsyncFunctionExpression : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
+
+
+ 1. If the function code for |AsyncFunctionExpression| is strict mode code, let _strict_ be *true*. Otherwise let _strict_ be *false*.
+ 1. Let _scope_ be the LexicalEnvironment of the running execution context.
+ 1. Let _funcEnv_ be ! NewDeclarativeEnvironment(_scope_).
+ 1. Let _envRec_ be _funcEnv_'s EnvironmentRecord.
+ 1. Let _name_ be StringValue of |BindingIdentifier|.
+ 1. Perform ! _envRec_.CreateImmutableBinding(_name_).
+ 1. Let _closure_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _funcEnv_, _strict_).
+ 1. Set _closure_.[[SourceText]] to the source text matched by |AsyncFunctionExpression|.
+ 1. Perform ! SetFunctionName(_closure_, _name_).
+ 1. Perform ! _envRec_.InitializeBinding(_name_, _closure_).
+ 1. Return _closure_.
+
+
+
+ AwaitExpression : `await` UnaryExpression
+
+
+ 1. Let _exprRef_ be the result of evaluating |UnaryExpression|.
+ 1. Let _value_ be ? GetValue(_exprRef_).
+ 1. Return ? AsyncFunctionAwait(_value_).
+
+
+
+
+
+ Async Arrow Function Definitions
+ Syntax
+
+ AsyncArrowFunction[In, Yield, Await] :
+ `async` [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] `=>` AsyncConciseBody[?In, ?Yield]
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] `=>` AsyncConciseBody[?In, ?Yield] #callcover
+
+ AsyncConciseBody[In, Yield] :
+ [lookahead != `{`] AssignmentExpression[?In, ?Yield, +Await]
+ `{` AsyncFunctionBody `}`
+
+ AsyncArrowBindingIdentifier[Yield] :
+ BindingIdentifier[?Yield, +Await]
+
+ CoverCallExpressionAndAsyncArrowHead[Yield, Await] :
+ MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+ Supplemental Syntax
+ When processing the production AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] `=>` AsyncConciseBody the interpretation of |CoverCallExpressionAndAsyncArrowHead| is refined using the following grammar:
+
+
+ AsyncArrowHead :
+ `async` [no LineTerminator here] ArrowFormalParameters[+Yield, +Await]
+
+
+
+ Static Semantics: Early Errors
+
+ AsyncArrowFunction : `async` [no LineTerminator here] AsyncArrowBindingIdentifier [no LineTerminator here] `=>` AsyncConciseBody
+
+
+ - It is a Syntax Error if ContainsUseStrict of |AsyncConciseBody| is *true* and IsSimpleParameterList of |ArrowParameters| is *false*.
+ - It is a Syntax Error if any element of the BoundNames of |AsyncArrowBindingIdentifier| also occurs in the LexicallyDeclaredNames of |AsyncConciseBody|.
+
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] `=>` AsyncConciseBody
+
+
+ - It is a Syntax Error if |CoverCallExpressionAndAsyncArrowHead| Contains |YieldExpression| is *true*.
+ - It is a Syntax Error if |CoverCallExpressionAndAsyncArrowHead| Contains |AwaitExpression| is *true*.
+ - It is a Syntax Error if any element of the BoundNames of |CoverCallExpressionAndAsyncArrowHead| also occurs in the LexicallyDeclaredNames of |AsyncConciseBody|.
+ - It is a Syntax Error if the lexical token sequence matched by |CoverCallExpressionAndAsyncArrowHead| cannot be parsed with no tokens left over using |AsyncArrowHead| as the goal symbol.
+ - All Early Error rules for |AsyncArrowHead| and its derived productions apply to CoveredAsyncArrowHead of |CoverCallExpressionAndAsyncArrowHead|.
+
+
+
+
+ Static Semantics: CoveredAsyncArrowHead
+
+
+ CoverCallExpressionAndAsyncArrowHead : MemberExpression Arguments
+
+
+ 1. Return the result of parsing the lexical token stream matched by |CoverCallExpressionAndAsyncArrowHead| using |AsyncArrowHead| as the goal symbol.
+
+
+
+
+ Static Semantics: BoundNames
+
+ CoverCallExpressionAndAsyncArrowHead : MemberExpression Arguments
+
+
+ 1. Let _head_ be CoveredAsyncFunctionHead of |CoverCallExpressionAndAsyncArrowHead|.
+ 1. Return the BoundNames of _head_.
+
+
+
+
+ Static Semantics: Contains
+ With parameter _symbol_.
+
+ AsyncArrowFunction : `async` [no LineTerminator here] AsyncArrowBindingIdentifier [no LineTerminator here] `=>` AsyncConciseBody
+
+
+ 1. If _symbol_ is not one of |NewTarget|, |SuperProperty|, |SuperCall|, `super`, or `this`, return *false*.
+ 1. Return |AsyncConciseBody| Contains _symbol_.
+
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] `=>` AsyncConciseBody
+
+
+ 1. If _symbol_ is not one of |NewTarget|, |SuperProperty|, |SuperCall|, `super`, or `this`, return *false*.
+ 2. Let _head_ be CoveredAsyncFunctionHead of |CoverCallExpressionAndAsyncArrowHead|.
+ 3. If _head_ Contains _symbol_ is *true*, return *true*.
+ 4. Return |AsyncConciseBody| Contains _symbol_.
+
+ Normally, Contains does not look inside most function forms. However, Contains is used to detect `new.target`, `this`, and `super` usage within an AsyncArrowFunction.
+
+
+
+ Static Semantics: ContainsExpression
+
+ AsyncArrowBindingIdentifier : BindingIdentifier
+
+
+ 1. Return *false*.
+
+
+
+
+ Static Semantics: ExpectedArgumentCount
+
+ AsyncArrowBindingIdentifier : BindingIdentifier
+
+
+ 1. Return 1.
+
+
+
+
+ Static Semantics: HasName
+
+ AsyncArrowFunction : `async` [no LineTerminator here] AsyncArrowBindingIdentifier [no LineTerminator here] `=>` AsyncConciseBody
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] `=>` AsyncConciseBody
+
+
+ 1. Return *false*.
+
+
+
+
+ Static Semantics: IsSimpleParameterList
+
+ AsyncArrowBindingIdentifier[Yield] : BindingIdentifier[?Yield, +Await]
+
+
+ 1. Return *true*.
+
+
+
+
+ Static Semantics: LexicallyDeclaredNames
+
+ AsyncConciseBody : [lookahead != `{`] AssignmentExpression
+
+
+ 1. Return a new empty List.
+
+
+
+
+ Static Semantics: LexicallyScopedDeclarations
+
+ AsyncConciseBody : [lookahead != `{`] AssignmentExpression
+
+
+ 1. Return a new empty List.
+
+
+
+
+ Static Semantics: VarDeclaredNames
+
+ AsyncConciseBody : [lookahead != `{`] AssignmentExpression
+
+
+ 1. Return a new empty List.
+
+
+
+
+ Static Semantics: VarScopedDeclarations
+
+ AsyncConciseBody : [lookahead != `{`] AssignmentExpression
+
+
+ 1. Return a new empty List.
+
+
+
+
+ Runtime Semantics: IteratorBindingInitialization
+ With parameters _iteratorRecord_ and _environment_.
+
+ AsyncArrowBindingIdentifier : BindingIdentifier
+
+
+ 1. Assert: _iteratorRecord_.[[done]] is *false*.
+ 1. Let _next_ be ? IteratorStep(_iteratorRecord_.[[iterator]]).
+ 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[done]] to *true*.
+ 1. ReturnIfAbrupt(_next_).
+ 1. If _next_ is *false*, set _iteratorRecord_.[[done]] to *true*.
+ 1. Else,
+ 1. Let _v_ be ? IteratorValue(_next_).
+ 1. If _v_ is an abrupt completion, set _iteratorRecord_.[[done]] to *true*.
+ 1. ReturnIfAbrupt(_v_).
+ 1. If _iteratorRecord_.[[done]] is *true*, let _v_ be *undefined*.
+ 1. Return the result of performing BindingInitialization for |BindingIdentifier| using _v_ and _environment_ as the arguments.
+
+
+
+
+ Runtime Semantics: EvaluateBody
+ With parameter _functionObject_ and List _argumentsList_.
+
+ AsyncConciseBody : [lookahead != `{`] AssignmentExpression
+
+
+ 1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
+ 1. Let _declResult_ be ? FunctionDeclarationInstantiation(_functionObject_, _argumentsList_).
+ 1. If _declResult_ is not an abrupt completion, then
+ 1. Perform ! AsyncFunctionStart(_promiseCapability_, _AssignmentExpression_).
+ 1. Else _declResult_ is an abrupt completion,
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, «_declResult_.[[value]]»).
+ 1. Return Completion{[[type]]: ~return~, [[value]]: _promiseCapability_.[[Promise]], [[target]]: ~empty~}.
+
+
+ AsyncConciseBody : `{` AsyncFunctionBody `}`
+
+
+ 1. Return the result of EvaluateBody of |AsyncFunctionBody| passing _functionObject_ and _argumentsList_ as the arguments.
+
+
+
+
+ Runtime Semantics: Evaluation
+
+ AsyncArrowFunction : `async` [no LineTerminator here] AsyncArrowBindingIdentifier [no LineTerminator here] `=>` AsyncConciseBody
+
+
+ 1. If the function code for this |AsyncArrowFunction| is strict mode code, let _strict_ be *true*. Otherwise, let _strict_ be *false*.
+ 2. Let _scope_ be the LexicalEnvironment of the running execution context.
+ 3. Let _parameters_ be |AsyncArrowBindingIdentifier|.
+ 4. Let _closure_ be ! AsyncFunctionCreate(~Arrow~, _parameters_, |AsyncConciseBody|, _scope_, _strict_).
+ 1. Set _closure_.[[SourceText]] to the source text matched by |AsyncArrowFunction|.
+ 5. Return _closure_.
+
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] `=>` AsyncConciseBody
+
+
+ 1. If the function code for this |AsyncArrowFunction| is strict mode code, let _strict_ be *true*. Otherwise, let _strict_ be *false*.
+ 2. Let _scope_ be the LexicalEnvironment of the running execution context.
+ 3. Let _head_ be CoveredAsyncArrowHead of |CoverCallExpressionAndAsyncArrowHead|.
+ 4. Let _parameters_ be the |ArrowFormalParameters| of _head_.
+ 5. Let _closure_ be ! AsyncFunctionCreate(~Arrow~, _parameters_, |AsyncConciseBody|, _scope_, _strict_).
+ 1. Set _closure_.[[SourceText]] to the source text matched by |AsyncArrowFunction|.
+ 6. Return _closure_.
+
+
+
+
Tail Position Calls
@@ -19242,6 +19850,7 @@ Expression Rules
AssignmentExpression :
YieldExpression
ArrowFunction
+ AsyncArrowFunction
LeftHandSideExpression `=` AssignmentExpression
LeftHandSideExpression AssignmentOperator AssignmentExpression
@@ -19318,6 +19927,7 @@ Expression Rules
FunctionExpression
ClassExpression
GeneratorExpression
+ AsyncFunctionExpression
RegularExpressionLiteral
TemplateLiteral
@@ -19348,7 +19958,7 @@ Expression Rules
CallExpression :
- MemberExpression Arguments
+ CoverCallExpressionAndAsyncArrowHead
CallExpression Arguments
CallExpression TemplateLiteral
@@ -19410,7 +20020,7 @@ Syntax
ScriptBody?
ScriptBody :
- StatementList[~Yield, ~Return]
+ StatementList[~Yield, ~Await, ~Return]
@@ -19723,7 +20333,7 @@ Syntax
ModuleItem :
ImportDeclaration
ExportDeclaration
- StatementListItem[~Yield, ~Return]
+ StatementListItem[~Yield, ~Await, ~Return]
@@ -20995,7 +21605,7 @@ Syntax
StringLiteral
ImportedBinding :
- BindingIdentifier[~Yield]
+ BindingIdentifier[~Yield, ~Await]
@@ -21141,11 +21751,11 @@ Syntax
`export` `*` FromClause `;`
`export` ExportClause FromClause `;`
`export` ExportClause `;`
- `export` VariableStatement[~Yield]
- `export` Declaration[~Yield]
- `export` `default` HoistableDeclaration[~Yield, +Default]
- `export` `default` ClassDeclaration[~Yield, +Default]
- `export` `default` [lookahead <! {`function`, `class`}] AssignmentExpression[+In, ~Yield] `;`
+ `export` VariableStatement[~Yield, ~Await]
+ `export` Declaration[~Yield, ~Await]
+ `export` `default` HoistableDeclaration[~Yield, ~Await, +Default]
+ `export` `default` ClassDeclaration[~Yield, ~Await, +Default]
+ `export` `default` [lookahead <! {`function`, `async` [no |LineTerminator| here] `function`, `class`}] AssignmentExpression[+In, ~Yield, ~Await] `;`
ExportClause :
`{` `}`
@@ -21605,7 +22215,7 @@ Forbidden Extensions
An implementation must not extend this specification in the following ways:
-
- Other than as defined in this specification, ECMAScript Function objects defined using syntactic constructors in strict mode code must not be created with own properties named `"caller"` or `"arguments"` other than those that are created by applying the AddRestrictedFunctionProperties abstract operation to the function. Such own properties also must not be created for function objects defined using an |ArrowFunction|, |MethodDefinition|, |GeneratorDeclaration|, |GeneratorExpression|, |ClassDeclaration|, or |ClassExpression| regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the `Function` constructor, generator functions created using the `Generator` constructor, and functions created using the `bind` method also must not be created with such own properties.
+ Other than as defined in this specification, ECMAScript Function objects defined using syntactic constructors in strict mode code must not be created with own properties named `"caller"` or `"arguments"` other than those that are created by applying the AddRestrictedFunctionProperties abstract operation to the function. Such own properties also must not be created for function objects defined using an |ArrowFunction|, |MethodDefinition|, |GeneratorDeclaration|, |GeneratorExpression|, |ClassDeclaration|, |ClassExpression|, |AsyncFunctionDeclaration|, |AsyncFunctionExpression|, or |AsyncArrowFunction| regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the `Function` constructor, generator functions created using the `Generator` constructor, and functions created using the `bind` method also must not be created with such own properties.
-
If an implementation extends non-strict or built-in function objects with an own property named `"caller"` the value of that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function object. If it is an accessor property, the function that is the value of the property's [[Get]] attribute must never return a strict function when called.
@@ -23021,7 +23631,7 @@
Function Objects
The Function Constructor
The Function constructor is the %Function% intrinsic object and the initial value of the `Function` property of the global object. When `Function` is called as a function rather than as a constructor, it creates and initializes a new Function object. Thus the function call `Function(…)` is equivalent to the object creation expression `new Function(…)` with the same arguments.
- The `Function` constructor is designed to be subclassable. It may be used as the value of an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified `Function` behaviour must include a `super` call to the `Function` constructor to create and initialize a subclass instances with the internal slots necessary for built-in function behaviour. All ECMAScript syntactic forms for defining function objects create instances of `Function`. There is no syntactic means to create instances of `Function` subclasses except for the built-in `GeneratorFunction` subclass.
+ The `Function` constructor is designed to be subclassable. It may be used as the value of an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified `Function` behaviour must include a `super` call to the `Function` constructor to create and initialize a subclass instances with the internal slots necessary for built-in function behaviour. All ECMAScript syntactic forms for defining function objects create instances of `Function`. There is no syntactic means to create instances of `Function` subclasses except for the built-in `GeneratorFunction` and `AsyncFunction` subclasses.
@@ -23047,17 +23657,22 @@ Function ( _p1_, _p2_, … , _pn_, _body_ )
Runtime Semantics: CreateDynamicFunction(_constructor_, _newTarget_, _kind_, _args_)
- The abstract operation CreateDynamicFunction is called with arguments _constructor_, _newTarget_, _kind_, and _args_. _constructor_ is the constructor function that is performing this action, _newTarget_ is the constructor that `new` was initially applied to, _kind_ is either `"normal"` or `"generator"`, and _args_ is a List containing the actual argument values that were passed to _constructor_. The following steps are taken:
+ The abstract operation CreateDynamicFunction is called with arguments _constructor_, _newTarget_, _kind_, and _args_. _constructor_ is the constructor function that is performing this action, _newTarget_ is the constructor that `new` was initially applied to, _kind_ is either `"normal"`, `"generator"`, or `"async"`, and _args_ is a List containing the actual argument values that were passed to _constructor_. The following steps are taken:
1. If _newTarget_ is *undefined*, let _newTarget_ be _constructor_.
1. If _kind_ is `"normal"`, then
- 1. Let _goal_ be the grammar symbol |FunctionBody[~Yield]|.
- 1. Let _parameterGoal_ be the grammar symbol |FormalParameters[~Yield]|.
+ 1. Let _goal_ be the grammar symbol |FunctionBody[~Yield, ~Await]|.
+ 1. Let _parameterGoal_ be the grammar symbol |FormalParameters[~Yield, ~Await]|.
1. Let _fallbackProto_ be `"%FunctionPrototype%"`.
- 1. Else,
+ 1. Else if _kind_ is `"generator"`, then
1. Let _goal_ be the grammar symbol |GeneratorBody|.
- 1. Let _parameterGoal_ be the grammar symbol |FormalParameters[+Yield]|.
+ 1. Let _parameterGoal_ be the grammar symbol |FormalParameters[+Yield, ~Await]|.
1. Let _fallbackProto_ be `"%Generator%"`.
+ 1. Else,
+ 1. Assert: _kind_ is `"async"`.
+ 1. Let _goal_ be the grammar symbol |AsyncFunctionBody|.
+ 1. Let _parameterGoal_ be the grammar symbol |FormalParameters[~Yield, +Await]|.
+ 1. Let _fallbackProto_ be `"%AsyncFunctionPrototype%"`.
1. Let _argCount_ be the number of elements in _args_.
1. Let _P_ be the empty String.
1. If _argCount_ = 0, let _bodyText_ be the empty String.
@@ -23085,6 +23700,8 @@ Runtime Semantics: CreateDynamicFunction(_constructor_, _newTarget_, _kind_,
1. If _parameters_ Contains |SuperProperty| is *true*, throw a *SyntaxError* exception.
1. If _kind_ is `"generator"`, then
1. If _parameters_ Contains |YieldExpression| is *true*, throw a *SyntaxError* exception.
+ 1. If _kind_ is `"async"`, then
+ 1. If _parameters_ Contains |AwaitExpression| is *true*, throw a *SyntaxError* exception.
1. If _strict_ is *true*, then
1. If BoundNames of _parameters_ contains any duplicate elements, throw a *SyntaxError* exception.
1. Let _proto_ be ? GetPrototypeFromConstructor(_newTarget_, _fallbackProto_).
@@ -23096,6 +23713,7 @@ Runtime Semantics: CreateDynamicFunction(_constructor_, _newTarget_, _kind_,
1. Let _prototype_ be ObjectCreate(%GeneratorPrototype%).
1. Perform DefinePropertyOrThrow(_F_, `"prototype"`, PropertyDescriptor{[[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false*}).
1. Else, perform MakeConstructor(_F_).
+ 1. NOTE: Async functions are not constructable and do not have a prototype property.
1. Perform SetFunctionName(_F_, `"anonymous"`).
1. Return _F_.
@@ -34945,6 +35563,190 @@ Properties of Promise Instances
+
+
+ AsyncFunction Objects
+
+ The AsyncFunction Constructor
+
+ The `AsyncFunction` Constructor is the %AsyncFunction% intrinsic object and is a subclass of `Function`. When `AsyncFunction` is called as a function rather than as a constructor, it creates and initializes a new AsyncFunction object. Thus the function call `AsyncFunction(…)` is equivalent to the object creation expression `new AsyncFunction(…)` with the same arguments.
+
+ The `AsyncFunction` constructor is designed to be subclassable. It may be used as the value of an extends clause of a class definition. Subclass constructors that intend to inherit the specified AsyncFunction behaviour must include a super call to the AsyncFunction constructor to create and initialize a subclass instances with the internal slots necessary for built-in async function behaviour.
+
+
+ AsyncFunction(_p1_, _p2_, … , _pn_, _body_)
+
+ The last argument specifies the body (executable code) of an async function. Any preceding arguments specify formal parameters.
+
+ When the `AsyncFunction` function is called with some arguments _p1_, _p2_, …, _pn_, _body_ (where _n_ might be 0, that is, there are no _p_ arguments, and where _body_ might also not be provided), the following steps are taken:
+
+
+ 1. Let _C_ be the active function object.
+ 2. Let _args_ be the _argumentsList_ that was passed to this function by [[Call]] or [[Construct]].
+ 3. Return CreateDynamicFunction(_C_, NewTarget, `"async"`, _args_).
+
+
+ See note for 19.2.1.1
+
+
+
+ Properties of the AsyncFunction Constructor
+
+ The AsyncFunction constructor is a standard built-in function object that inherits from the `Function` constructor. The value of the [[Prototype]] internal slot of the AsyncFunction constructor is the intrinsic object %Function%.
+
+ The value of the [[Extensible]] internal slot of the AsyncFunction constructor is *true*.
+
+ The value of the *name* property of the AsyncFunction is "AsyncFunction".
+
+ The AsyncFunction constructor has the following properties:
+
+
+ AsyncFunction.length
+ This is a data property with a value of 1. This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
+
+
+
+ AsyncFunction.prototype
+ The initial value of `AsyncFunction.prototype` is the intrinsic object %AsyncFunctionPrototype%.
+
+ This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.
+
+
+
+ Properties of the AsyncFunction Prototype Object
+ The AsyncFunction prototype object is an ordinary object. In addition to being the value of the prototype property of the %AsyncFunction% intrinsic, it is the %AsyncFunctionPrototype% intrinsic.
+
+ The value of the [[Prototype]] internal slot of the AsyncFunction prototype object is the %FunctionPrototype% intrinsic object. The initial value of the [[Extensible]] internal slot of the AsyncFunction prototype object is *true*.
+
+ The AsyncFunction prototype object does not have a prototype property.
+ Presumably this could be Promise.prototype but I'm not sure this has any value?
+
+
+
+ AsyncFunction.prototype.constructor
+
+ The initial value of `AsyncFunction.prototype.constructor` is the intrinsic object %AsyncFunction%
+
+ This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
+
+
+
+ AsyncFunction.prototype [ @@toStringTag ]
+
+ The initial value of the @@toStringTag property is the string value "AsyncFunction".
+
+ This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
+
+
+
+
+ AsyncFunction Instances
+
+ Every AsyncFunction instance is an ECMAScript function object and has the internal slots listed in . The value of the [[FunctionKind]] internal slot for all such instances is `"normal"`. AsyncFunction instances are not constructors and do not have a [[Construct]] internal slot. AsyncFunction instances do not have a prototype property as they are not constructable.
+ Each AsyncFunction instance has the following own properties:
+
+ length
+ The value of the *length* property is an integer that indicates the typical number of arguments expected by the AsyncFunction. However, the language permits the function to be invoked with some other number of arguments. The behaviour of an AsyncFunction when invoked on a number of arguments other than the number specified by its length property depends on the function.
+
+ This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
+
+
+
+ name
+
+ The specification for the `name` property of Function instances given in 19.2.4.2 also applies to AsyncFunction instances.
+
+
+
+
+ Async Functions Abstract Operations
+
+
+ AsyncFunctionCreate ( _kind_, _parameters_, _body_, _Scope_, _Strict_ )
+ The abstract operation AsyncFunctionCreate requires the arguments: _kind_ which is one of (~Normal~, ~Method~, ~Arrow~), a parameter list production specified by _parameters_, a body production specified by _body_, a Lexical Environment specified by _Scope_, and a Boolean flag _Strict_. AsyncFunctionCreate performs the following steps:
+
+ 1. Let _functionPrototype_ be the intrinsic object %AsyncFunctionPrototype%.
+ 2. Let _F_ be ! FunctionAllocate(_functionPrototype_, _Strict_, `"non-constructor"`).
+ 3. Return ! FunctionInitialize(_F_, _kind_, _parameters_, _body_, _Scope_).
+
+
+
+
+ AsyncFunctionStart ( _promiseCapability_, _asyncFunctionBody_ )
+
+ 1. Let _runningContext_ be the running execution context.
+ 1. Let _asyncContext_ be a copy of _runningContext_.
+ 1. Set the code evaluation state of _asyncContext_ such that when evaluation is resumed for that execution context the following steps will be performed:
+ 1. Let _result_ be the result of evaluating _asyncFunctionBody_.
+ 1. Assert: If we return here, the async function either threw an exception or performed an implicit or explicit return; all awaiting is done.
+ 1. Remove _asyncContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context.
+ 1. If _result_.[[type]] is ~normal~, then
+ 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, «*undefined*»).
+ 1. Else if _result_.[[type]] is ~return~, then
+ 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, «_result_.[[value]]»).
+ 1. Else,
+ 1. Assert: _result_.[[type]] is ~throw~.
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, «_result_.[[value]]»).
+ 1. Return.
+ 1. Push _asyncContext_ onto the execution context stack; _asyncContext_ is now the running execution context.
+ 1. Resume the suspended evaluation of _asyncContext_. Let _result_ be the value returned by the resumed computation.
+ 1. Assert: When we return here, _asyncContext_ has already been removed from the execution context stack and _runningContext_ is the currently running execution context.
+ 1. Assert: _result_ is a normal completion with a value of *undefined*. The possible sources of completion values are AsyncFunctionAwait or, if the async function doesn't await anything, the step 3.7 above.
+ 1. Return.
+
+
+
+
+ AsyncFunctionAwait ( _value_ )
+
+ 1. Let _asyncContext_ be the running execution context.
+ 1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
+ 1. Let _resolveResult_ be ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _value_ »).
+ 1. Let _onFulfilled_ be a new built-in function object as defined in .
+ 1. Let _onRejected_ be a new built-in function object as defined in .
+ 1. Set _onFulfilled_.[[AsyncContext]] to _asyncContext_.
+ 1. Set _onRejected_.[[AsyncContext]] to _asyncContext_.
+ 1. Let _throwawayCapability_ be NewPromiseCapability(%Promise%).
+ 1. Set _throwawayCapability_.[[Promise]].[[PromiseIsHandled]] to *true*.
+ 1. Perform ! PerformPromiseThen(_promiseCapability_.[[Promise]], _onFulfilled_, _onRejected_, _throwawayCapability_).
+ 1. Remove _asyncContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context.
+ 1. Set the code evaluation state of _asyncContext_ such that when evaluation is resumed with a Completion _resumptionValue_ the following steps will be performed:
+ 1. Return _resumptionValue_.
+ 1. Return.
+
+
+ The return value of this abstract operation is unused. The interesting return is that of _resumptionValue_ being returned to the |AwaitExpression| production that originally called this abstract operation.
+
+
+
+ AsyncFunction Awaited Fulfilled
+ Function _F_ is called with the parameter _value_. _F_ has an internal slot named [[AsyncContext]] which is the execution context that will be restored when _F_ is called.
+
+ 1. Let _asyncContext_ be _F_.[[AsyncContext]].
+ 1. Let _prevContext_ be the running execution context.
+ 1. Suspend _prevContext_.
+ 1. Push _asyncContext_ onto the execution context stack; _asyncContext_ is now the running execution context.
+ 1. Resume the suspended evaluation of _asyncContext_ using NormalCompletion(_value_) as the result of the operation that suspended it. Let _result_ be the value returned by the resumed computation.
+ 1. Assert: When we reach this step, _asyncContext_ has already been removed from the execution context stack and _prevContext_ is the currently running execution context.
+ 1. Return Completion(_result_).
+
+
+
+
+ AsyncFunction Awaited Rejected
+ Function _F_ is called with the parameter _reason_. _F_ has an internal slot named [[AsyncContext]] which is the execution context that will be restored when _F_ is called.
+
+ 1. Let _asyncContext_ be _F_.[[AsyncContext]].
+ 1. Let _prevContext_ be the running execution context.
+ 1. Suspend _prevContext_.
+ 1. Push _asyncContext_ onto the execution context stack; _asyncContext_ is now the running execution context.
+ 1. Resume the suspended evaluation of _asyncContext_ using Completion{[[type]]: ~throw~, [[value]]: _reason_, [[target]]: ~empty~} as the result of the operation that suspended it. Let _result_ be the value returned by the resumed computation.
+ 1. Assert: When we reach this step, _asyncContext_ has already been removed from the execution context stack and _prevContext_ is the currently running execution context.
+ 1. Return Completion(_result_).
+
+
+
+
@@ -35301,6 +36103,7 @@ Expressions
+
@@ -35329,6 +36132,11 @@ Expressions
+
+ When processing the production the interpretation of |CoverCallExpressionAndAsyncArrowHead| is refined using the following grammar:
+
+
+
@@ -35436,6 +36244,11 @@ Functions and Classes
When the production is recognized the following grammar is used to refine the interpretation of |CoverParenthesizedExpressionAndArrowParameterList|:
+
+
+ When the production is recognized the following grammar is used to refine the interpretation of |CoverParenthesizedExpressionAndArrowParameterList|:
+
+
@@ -35443,6 +36256,11 @@ Functions and Classes
+
+
+
+
+
@@ -36615,13 +37433,13 @@ Changes to BlockDeclarationInstantiation
FunctionDeclarations in IfStatement Statement Clauses
The following augments the |IfStatement| production in :
- IfStatement[Yield, Return] :
- `if` `(` Expression[+In, ?Yield] `)` FunctionDeclaration[?Yield, ~Default] `else` Statement[?Yield, ?Return]
- `if` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return] `else` FunctionDeclaration[?Yield, ~Default]
- `if` `(` Expression[+In, ?Yield] `)` FunctionDeclaration[?Yield, ~Default] `else` FunctionDeclaration[?Yield, ~Default]
- `if` `(` Expression[+In, ?Yield] `)` FunctionDeclaration[?Yield, ~Default]
+ IfStatement[Yield, Await, Return] :
+ `if` `(` Expression[+In, ?Yield, ?Await] `)` FunctionDeclaration[?Yield, ?Await, ~Default] `else` Statement[?Yield, ?Await, ?Return]
+ `if` `(` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `else` FunctionDeclaration[?Yield, ?Await, ~Default]
+ `if` `(` Expression[+In, ?Yield, ?Await] `)` FunctionDeclaration[?Yield, ?Await, ~Default] `else` FunctionDeclaration[?Yield, ?Await, ~Default]
+ `if` `(` Expression[+In, ?Yield, ?Await] `)` FunctionDeclaration[?Yield, ?Await, ~Default]
- This production only applies when parsing non-strict code. Code matching this production is processed as if each matching occurrence of |FunctionDeclaration[?Yield, ~Default]| was the sole |StatementListItem| of a |BlockStatement| occupying that position in the source code. The semantics of such a synthetic |BlockStatement| includes the web legacy compatibility semantics specified in .
+ This production only applies when parsing non-strict code. Code matching this production is processed as if each matching occurrence of |FunctionDeclaration[?Yield, ?Await, ~Default]| was the sole |StatementListItem| of a |BlockStatement| occupying that position in the source code. The semantics of such a synthetic |BlockStatement| includes the web legacy compatibility semantics specified in .
@@ -36660,8 +37478,8 @@ VariableStatements in Catch Blocks
Initializers in ForIn Statement Heads
The following augments the |IterationStatement| production in :
- IterationStatement[Yield, Return] :
- `for` `(` `var` BindingIdentifier[?Yield] Initializer[~In, ?Yield] `in` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ IterationStatement[Yield, Await, Return] :
+ `for` `(` `var` BindingIdentifier[?Yield, ?Await] Initializer[~In, ?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return]
This production only applies when parsing non-strict code.
The static semantics of ContainsDuplicateLabels in are augmented with the following:
|