diff --git a/spec.emu b/spec.emu index d7a63af..09f44f4 100644 --- a/spec.emu +++ b/spec.emu @@ -71,7 +71,7 @@ contributors: Ron Buckton, Ecma International `"Symbol.asyncDispose"` - A method that performs explicit resource cleanup on an object. Called by the semantics of the `using await` declaration and AsyncDisposableStack objects. + A method that performs explicit resource cleanup on an object. Called by the semantics of the `await using` declaration and AsyncDisposableStack objects. @@ -975,7 +975,7 @@ contributors: Ron Buckton, Ecma International ~sync-dispose~ or ~async-dispose~. - Indicates whether the resource was added by a `using` declaration or DisposableStack object (~sync-dispose~) or a `using await` declaration or AsyncDisposableStack object (~async-dispose~). + Indicates whether the resource was added by a `using` declaration or DisposableStack object (~sync-dispose~) or a `await using` declaration or AsyncDisposableStack object (~async-dispose~). @@ -1152,7 +1152,9 @@ contributors: Ron Buckton, Ecma International UsingDeclaration : `using` BindingList `;` - `using await` BindingList `;` + + AwaitUsingDeclaration : + CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList `;` 1. Return the BoundNames of |BindingList|. @@ -1394,12 +1396,6 @@ contributors: Ron Buckton, Ecma International 1. Return IsConstantDeclaration of |LetOrConst|. - - LexicalDeclaration : UsingDeclaration - - 1. Return *true*. - - LetOrConst : `let` 1. Return *false*. @@ -1408,6 +1404,18 @@ contributors: Ron Buckton, Ecma International 1. Return *true*. + + + UsingDeclaration : + `using` BindingList `;` + + AwaitUsingDeclaration : + CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList `;` + + + 1. Return *true*. + + FunctionDeclaration : `function` BindingIdentifier `(` FormalParameters `)` `{` FunctionBody `}` @@ -1462,7 +1470,9 @@ contributors: Ron Buckton, Ecma International UsingDeclaration : `using` BindingList `;` - `using` `await` BindingList `;` + + AwaitUsingDeclaration : + CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList `;` 1. Return *true*. @@ -1474,7 +1484,7 @@ contributors: Ron Buckton, Ecma International ForDeclaration : `using` ForBinding - `using` `await` ForBinding + `await` `using` ForBinding 1. Return *true*. @@ -1518,8 +1528,8 @@ contributors: Ron Buckton, Ecma International - -

Static Semantics: IsUsingAwaitDeclaration ( ): a Boolean

+ +

Static Semantics: IsAwaitUsingDeclaration ( ): a Boolean

LexicalDeclaration : LetOrConst BindingList `;` @@ -1530,7 +1540,7 @@ contributors: Ron Buckton, Ecma International 1. Return *false*. - UsingDeclaration : `using` `await` BindingList `;` + AwaitUsingDeclaration : CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList `;` 1. Return *true*. @@ -1542,7 +1552,7 @@ contributors: Ron Buckton, Ecma International 1. Return *false*. - ForDeclaration : `using` `await` ForBinding + ForDeclaration : `await` `using` ForBinding 1. Return *true*. @@ -1587,6 +1597,157 @@ contributors: Ron Buckton, Ecma International
+ +

Function Name Inference

+ +

Static Semantics: IsFunctionDefinition ( ): a Boolean

+
+
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList + + 1. Let _expr_ be the |ParenthesizedExpression| that is covered by |CoverParenthesizedExpressionAndArrowParameterList|. + 1. Return IsFunctionDefinition of _expr_. + + + PrimaryExpression : + `this` + IdentifierReference + Literal + ArrayLiteral + ObjectLiteral + RegularExpressionLiteral + TemplateLiteral + + MemberExpression : + MemberExpression `[` Expression `]` + MemberExpression `.` IdentifierName + MemberExpression TemplateLiteral + SuperProperty + MetaProperty + `new` MemberExpression Arguments + MemberExpression `.` PrivateIdentifier + + NewExpression : + `new` NewExpression + + LeftHandSideExpression : + CallExpression + OptionalExpression + + UpdateExpression : + LeftHandSideExpression `++` + LeftHandSideExpression `--` + `++` UnaryExpression + `--` UnaryExpression + + UnaryExpression : + `delete` UnaryExpression + `void` UnaryExpression + `typeof` UnaryExpression + `+` UnaryExpression + `-` UnaryExpression + `~` UnaryExpression + `!` UnaryExpression + AwaitExpression + CoverAwaitExpressionAndAwaitUsingDeclarationHead + + + AwaitExpression : + `await` UnaryExpression + + + ExponentiationExpression : + UpdateExpression `**` ExponentiationExpression + + MultiplicativeExpression : + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + AdditiveExpression : + AdditiveExpression `+` MultiplicativeExpression + AdditiveExpression `-` MultiplicativeExpression + + ShiftExpression : + ShiftExpression `<<` AdditiveExpression + ShiftExpression `>>` AdditiveExpression + ShiftExpression `>>>` AdditiveExpression + + RelationalExpression : + RelationalExpression `<` ShiftExpression + RelationalExpression `>` ShiftExpression + RelationalExpression `<=` ShiftExpression + RelationalExpression `>=` ShiftExpression + RelationalExpression `instanceof` ShiftExpression + RelationalExpression `in` ShiftExpression + PrivateIdentifier `in` ShiftExpression + + EqualityExpression : + EqualityExpression `==` RelationalExpression + EqualityExpression `!=` RelationalExpression + EqualityExpression `===` RelationalExpression + EqualityExpression `!==` RelationalExpression + + BitwiseANDExpression : + BitwiseANDExpression `&` EqualityExpression + + BitwiseXORExpression : + BitwiseXORExpression `^` BitwiseANDExpression + + BitwiseORExpression : + BitwiseORExpression `|` BitwiseXORExpression + + LogicalANDExpression : + LogicalANDExpression `&&` BitwiseORExpression + + LogicalORExpression : + LogicalORExpression `||` LogicalANDExpression + + CoalesceExpression : + CoalesceExpressionHead `??` BitwiseORExpression + + ConditionalExpression : + ShortCircuitExpression `?` AssignmentExpression `:` AssignmentExpression + + AssignmentExpression : + YieldExpression + LeftHandSideExpression `=` AssignmentExpression + LeftHandSideExpression AssignmentOperator AssignmentExpression + LeftHandSideExpression `&&=` AssignmentExpression + LeftHandSideExpression `||=` AssignmentExpression + LeftHandSideExpression `??=` AssignmentExpression + + Expression : + Expression `,` AssignmentExpression + + + 1. Return *false*. + + + AssignmentExpression : + ArrowFunction + AsyncArrowFunction + + FunctionExpression : + `function` BindingIdentifier? `(` FormalParameters `)` `{` FunctionBody `}` + + GeneratorExpression : + `function` `*` BindingIdentifier? `(` FormalParameters `)` `{` GeneratorBody `}` + + AsyncGeneratorExpression : + `async` `function` `*` BindingIdentifier? `(` FormalParameters `)` `{` AsyncGeneratorBody `}` + + AsyncFunctionExpression : + `async` `function` BindingIdentifier? `(` FormalParameters `)` `{` AsyncFunctionBody `}` + + ClassExpression : + `class` BindingIdentifier? ClassTail + + + 1. Return *true*. + +
+
+ +

Miscellaneous

@@ -1767,6 +1928,170 @@ contributors: Ron Buckton, Ecma International
+ +

Static Semantics: AssignmentTargetType ( ): ~simple~ or ~invalid~

+
+
+ IdentifierReference : Identifier + + 1. If this |IdentifierReference| is contained in strict mode code and StringValue of |Identifier| is *"eval"* or *"arguments"*, return ~invalid~. + 1. Return ~simple~. + + + IdentifierReference : + `yield` + `await` + + CallExpression : + CallExpression `[` Expression `]` + CallExpression `.` IdentifierName + CallExpression `.` PrivateIdentifier + + MemberExpression : + MemberExpression `[` Expression `]` + MemberExpression `.` IdentifierName + SuperProperty + MemberExpression `.` PrivateIdentifier + + + 1. Return ~simple~. + + + PrimaryExpression : + CoverParenthesizedExpressionAndArrowParameterList + + + 1. Let _expr_ be the |ParenthesizedExpression| that is covered by |CoverParenthesizedExpressionAndArrowParameterList|. + 1. Return AssignmentTargetType of _expr_. + + + PrimaryExpression : + `this` + Literal + ArrayLiteral + ObjectLiteral + FunctionExpression + ClassExpression + GeneratorExpression + AsyncFunctionExpression + AsyncGeneratorExpression + RegularExpressionLiteral + TemplateLiteral + + CallExpression : + CoverCallExpressionAndAsyncArrowHead + SuperCall + ImportCall + CallExpression Arguments + CallExpression TemplateLiteral + + NewExpression : + `new` NewExpression + + MemberExpression : + MemberExpression TemplateLiteral + `new` MemberExpression Arguments + + NewTarget : + `new` `.` `target` + + ImportMeta : + `import` `.` `meta` + + LeftHandSideExpression : + OptionalExpression + + UpdateExpression : + LeftHandSideExpression `++` + LeftHandSideExpression `--` + `++` UnaryExpression + `--` UnaryExpression + + UnaryExpression : + `delete` UnaryExpression + `void` UnaryExpression + `typeof` UnaryExpression + `+` UnaryExpression + `-` UnaryExpression + `~` UnaryExpression + `!` UnaryExpression + AwaitExpression + CoverAwaitExpressionAndAwaitUsingDeclarationHead + + + AwaitExpression : + `await` UnaryExpression + + + ExponentiationExpression : + UpdateExpression `**` ExponentiationExpression + + MultiplicativeExpression : + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + AdditiveExpression : + AdditiveExpression `+` MultiplicativeExpression + AdditiveExpression `-` MultiplicativeExpression + + ShiftExpression : + ShiftExpression `<<` AdditiveExpression + ShiftExpression `>>` AdditiveExpression + ShiftExpression `>>>` AdditiveExpression + + RelationalExpression : + RelationalExpression `<` ShiftExpression + RelationalExpression `>` ShiftExpression + RelationalExpression `<=` ShiftExpression + RelationalExpression `>=` ShiftExpression + RelationalExpression `instanceof` ShiftExpression + RelationalExpression `in` ShiftExpression + PrivateIdentifier `in` ShiftExpression + + EqualityExpression : + EqualityExpression `==` RelationalExpression + EqualityExpression `!=` RelationalExpression + EqualityExpression `===` RelationalExpression + EqualityExpression `!==` RelationalExpression + + BitwiseANDExpression : + BitwiseANDExpression `&` EqualityExpression + + BitwiseXORExpression : + BitwiseXORExpression `^` BitwiseANDExpression + + BitwiseORExpression : + BitwiseORExpression `|` BitwiseXORExpression + + LogicalANDExpression : + LogicalANDExpression `&&` BitwiseORExpression + + LogicalORExpression : + LogicalORExpression `||` LogicalANDExpression + + CoalesceExpression : + CoalesceExpressionHead `??` BitwiseORExpression + + ConditionalExpression : + ShortCircuitExpression `?` AssignmentExpression `:` AssignmentExpression + + AssignmentExpression : + YieldExpression + ArrowFunction + AsyncArrowFunction + LeftHandSideExpression `=` AssignmentExpression + LeftHandSideExpression AssignmentOperator AssignmentExpression + LeftHandSideExpression `&&=` AssignmentExpression + LeftHandSideExpression `||=` AssignmentExpression + LeftHandSideExpression `??=` AssignmentExpression + + Expression : + Expression `,` AssignmentExpression + + + 1. Return ~invalid~. + +
+ @@ -1821,7 +2146,7 @@ contributors: Ron Buckton, Ecma International InitializeBinding(N, V, _hint_) - Set the value of an already existing but uninitialized binding in an Environment Record. The String value _N_ is the text of the bound name. _V_ is the value for the binding and is a value of any ECMAScript language type. _hint_ indicates whether the binding came from either a `using` declaration (~sync-dispose~), a `using await` declaration (~async-dispose~), or a regular variable declaration (~normal~). + Set the value of an already existing but uninitialized binding in an Environment Record. The String value _N_ is the text of the bound name. _V_ is the value for the binding and is a value of any ECMAScript language type. _hint_ indicates whether the binding came from either a `using` declaration (~sync-dispose~), a `await using` declaration (~async-dispose~), or a regular variable declaration (~normal~). @@ -1879,7 +2204,7 @@ contributors: Ron Buckton, Ecma International

Declarative Environment Records

Each Declarative Environment Record is associated with an ECMAScript program scope containing variable, constant, let, class, module, import, and/or function declarations. A declarative Environment Record binds the set of identifiers defined by the declarations contained within its scope.

-

Every Declarative Environment Record also has a [[DisposeCapability]] field, which contains a DisposeCapability Record. This field holds a stack of resources tracked by the `using` declarations and `using await` declarations that must be disposed when the Evaluation step that constructed the Environment Record has completed.

+

Every Declarative Environment Record also has a [[DisposeCapability]] field, which contains a DisposeCapability Record. This field holds a stack of resources tracked by the `using` declarations and `await using` declarations that must be disposed when the Evaluation step that constructed the Environment Record has completed.

The behaviour of the concrete specification methods for Declarative Environment Records is defined by the following algorithms.

@@ -2112,6 +2437,44 @@ contributors: Ron Buckton, Ecma International
+ +

ECMAScript Language: Expressions

+ +

Unary Operators

+

Syntax

+ + 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] + [+Await] CoverAwaitExpressionAndAwaitUsingDeclarationHead[?Yield] + + + CoverAwaitExpressionAndAwaitUsingDeclarationHead[Yield] : + `await` UnaryExpression[?Yield, +Await] + + + +

Supplemental Syntax

+

+ When processing an instance of the production
+ UnaryExpression : CoverAwaitExpressionAndAwaitUsingDeclarationHead
+ the interpretation of |CoverAwaitExpressionAndAwaitUsingDeclarationHead| is refined using the following grammar: +

+ + AwaitExpression[?Yield] : + `await` UnaryExpression[?Yield, +Await] + +
+
+
+

ECMAScript Language: Statements and Declarations

@@ -2179,36 +2542,51 @@ contributors: Ron Buckton, Ecma International

Syntax

LexicalDeclaration[In, Yield, Await] : - LetOrConst BindingList[?In, ?Yield, ?Await, ~Using] `;` + LetOrConst BindingList[?In, ?Yield, ?Await, +Pattern] `;` UsingDeclaration[?In, ?Yield, ?Await] + [+Await] AwaitUsingDeclaration[?In, ?Yield] LetOrConst : `let` `const` - + UsingDeclaration[In, Yield, Await] : - `using` [no LineTerminator here] [lookahead != `await`] BindingList[?In, ?Yield, ?Await, +Using] `;` - [+Await] `using` [no LineTerminator here] `await` [no LineTerminator here] BindingList[?In, ?Yield, +Await, +Using] `;` + `using` [no LineTerminator here] BindingList[?In, ?Yield, ?Await, ~Pattern] `;` + + AwaitUsingDeclaration[In, Yield] : + CoverAwaitExpressionAndAwaitUsingDeclarationHead[?Yield] [no LineTerminator here] BindingList[?In, ?Yield, ?Await, ~Pattern] `;` - BindingList[In, Yield, Await, Using] : - LexicalBinding[?In, ?Yield, ?Await, ?Using] - BindingList[?In, ?Yield, ?Await, ?Using] `,` LexicalBinding[?In, ?Yield, ?Await, ?Using] + BindingList[In, Yield, Await, Pattern] : + LexicalBinding[?In, ?Yield, ?Await, ?Pattern] + BindingList[?In, ?Yield, ?Await, ?Pattern] `,` LexicalBinding[?In, ?Yield, ?Await, ?Pattern] - LexicalBinding[In, Yield, Await, Using] : + LexicalBinding[In, Yield, Await, Pattern] : BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]? BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await] - [~Using] BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await] + [+Pattern] BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await] + +

Supplemental Syntax

+

+ When processing an instance of the production
+ AwaitUsingDeclaration : CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList `;`
+ the interpretation of |CoverAwaitExpressionAndAwaitUsingDeclarationHead| is refined using the following grammar: +

+ + AwaitUsingDeclarationHead : + `await` [no LineTerminator here] `using` + +
+

Static Semantics: Early Errors

UsingDeclaration : `using` BindingList `;` - `using` `await` BindingList `;`
  • @@ -2224,6 +2602,22 @@ contributors: Ron Buckton, Ecma International It is a Syntax Error if the goal symbol is |Script| and |UsingDeclaration| is not contained, either directly or indirectly, within a |Block|, |CaseBlock|, |ForStatement|, |ForInOfStatement|, |FunctionBody|, |GeneratorBody|, |AsyncGeneratorBody|, |AsyncFunctionBody|, |ClassStaticBlockBody|, or |ClassBody|.
+ + AwaitUsingDeclaration : + CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList `;` + +
    +
  • |CoverAwaitExpressionAndAwaitUsingDeclarationHead| must cover an |AwaitUsingDeclarationHead|.
  • +
  • + It is a Syntax Error if the BoundNames of |BindingList| contains *"let"*. +
  • +
  • + It is a Syntax Error if the BoundNames of |BindingList| contains any duplicate entries. +
  • +
  • + It is a Syntax Error if the goal symbol is |Script| and |AwaitUsingDeclaration| is not contained, either directly or indirectly, within a |Block|, |CaseBlock|, |ForStatement|, |ForInOfStatement|, |FunctionBody|, |GeneratorBody|, |AsyncGeneratorBody|, |AsyncFunctionBody|, |ClassStaticBlockBody|, or |ClassBody|. +
  • +
Draft Note: This behavior is currently under discussion in #66. The above boundaries have been chosen for the following reasons:
    @@ -2245,21 +2639,18 @@ contributors: Ron Buckton, Ecma International 1. Perform ? EvaluationBindingEvaluation of |BindingList| with parameter ~normal~. 1. Return ~empty~. - UsingDeclaration : `using` BindingList `;` 1. Perform ? BindingEvaluation of |BindingList| with parameter ~sync-dispose~. 1. Return ~empty~. - - UsingDeclaration : `using` `await` BindingList `;` + AwaitUsingDeclaration : CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList `;` 1. Perform ? BindingEvaluation of |BindingList| with parameter ~async-dispose~. 1. Return ~empty~. - BindingList : BindingList `,` LexicalBinding @@ -2474,24 +2865,24 @@ contributors: Ron Buckton, Ecma International ForInOfStatement[Yield, Await, Return] : `for` `(` [lookahead != `let` `[`] LeftHandSideExpression[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - `for` `(` `var` ForBinding[?Yield, ?Await, ~Using] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + `for` `(` `var` ForBinding[?Yield, ?Await, +Pattern] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` ForDeclaration[?Yield, ?Await, ~Using] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` [lookahead ∉ {`let`, `async` `of`}] LeftHandSideExpression[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - `for` `(` `var` ForBinding[?Yield, ?Await, ~Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + `for` `(` `var` ForBinding[?Yield, ?Await, +Pattern] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` [lookahead != `using` `of`] ForDeclaration[?Yield, ?Await, +Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] [+Await] `for` `await` `(` [lookahead != `let`] LeftHandSideExpression[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - [+Await] `for` `await` `(` `var` ForBinding[?Yield, ?Await, ~Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + [+Await] `for` `await` `(` `var` ForBinding[?Yield, ?Await, +Pattern] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] [+Await] `for` `await` `(` [lookahead != `using` `of`] ForDeclaration[?Yield, ?Await, +Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] ForDeclaration[Yield, Await, Using] : - LetOrConst ForBinding[?Yield, ?Await, ~Using] - [+Using] `using` [no LineTerminator here] [lookahead != `await`] ForBinding[?Yield, ?Await, +Using] - [+Using, +Await] `using` [no LineTerminator here] `await` [no LineTerminator here] ForBinding[?Yield, +Await, +Using] + LetOrConst ForBinding[?Yield, ?Await, +Pattern] + [+Using] `using` [no LineTerminator here] ForBinding[?Yield, ?Await, ~Pattern] + [+Using, +Await] `await` [no LineTerminator here] `using` [no LineTerminator here] ForBinding[?Yield, +Await, ~Pattern] - ForBinding[Yield, Await, Using] : + ForBinding[Yield, Await, Pattern] : BindingIdentifier[?Yield, ?Await] BindingPattern[?Yield, ?Await] - [~Using] BindingPattern[?Yield, ?Await] + [+Pattern] BindingPattern[?Yield, ?Await] @@ -2515,7 +2906,7 @@ contributors: Ron Buckton, Ecma International ForDeclaration : `using` ForBinding - `using` `await` ForBinding + `await` `using` ForBinding 1. Assert: _environment_ is a declarative Environment Record. @@ -2543,7 +2934,7 @@ contributors: Ron Buckton, Ecma International 1. If _iteratorKind_ is not present, set _iteratorKind_ to ~sync~. 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. 1. Let _V_ be *undefined*. - 1. If IsUsingAwaitDeclaration of _lhs_ is *true*, then + 1. If IsAwaitUsingDeclaration of _lhs_ is *true*, then 1. Let _hint_ be ~async-dispose~. 1. Else, if IsUsingDeclaration of _lhs_ is *true*, then 1. Let _hint_ be ~sync-dispose~. @@ -2962,6 +3353,37 @@ contributors: Ron Buckton, Ecma International

    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` BindingIdentifier[~Yield, +Await]? `(` FormalParameters[~Yield, +Await] `)` `{` AsyncFunctionBody `}` + + AsyncMethod[Yield, Await] : + `async` [no LineTerminator here] ClassElementName[?Yield, ?Await] `(` UniqueFormalParameters[~Yield, +Await] `)` `{` AsyncFunctionBody `}` + + AsyncFunctionBody : + FunctionBody[~Yield, +Await] + + AwaitExpression[Yield] : + `await` UnaryExpression[?Yield, +Await] + + + +

    Static Semantics: Early Errors

    + + + UnaryExpression : CoverAwaitExpressionAndAwaitUsingDeclarationHead + +
      +
    • |CoverAwaitExpressionAndAwaitUsingDeclarationHead| must cover an |AwaitExpression|.
    • +
    +
    +
    +

    Runtime Semantics: InstantiateAsyncFunctionExpression ( @@ -3002,6 +3424,19 @@ contributors: Ron Buckton, Ecma International

    The |BindingIdentifier| in an |AsyncFunctionExpression| can be referenced from inside the |AsyncFunctionExpression|'s |AsyncFunctionBody| to allow the function to call itself recursively. However, unlike in a |FunctionDeclaration|, the |BindingIdentifier| in a |AsyncFunctionExpression| cannot be referenced from and does not affect the scope enclosing the |AsyncFunctionExpression|.

    + + +

    Runtime Semantics: Evaluation

    + + + UnaryExpression : CoverAwaitExpressionAndAwaitUsingDeclarationHead + + + 1. Let _expr_ be the |AwaitExpression| that is covered by |CoverAwaitExpressionAndAwaitUsingDeclarationHead|. + 1. Return ? Evaluation of _expr_. + + +
    @@ -3224,7 +3659,13 @@ contributors: Ron Buckton, Ecma International `-` UnaryExpression `~` UnaryExpression `!` UnaryExpression - AwaitExpression + AwaitExpression + CoverAwaitExpressionAndAwaitUsingDeclarationHead + + + AwaitExpression : + `await` UnaryExpression + CallExpression : SuperCall @@ -3379,7 +3820,13 @@ contributors: Ron Buckton, Ecma International 1. Return *false*. - LexicalDeclaration : UsingDeclaration + + UsingDeclaration : + `using` BindingList `;` + + AwaitUsingDeclaration : + CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList `;` + 1. Return *true*. @@ -3915,7 +4362,7 @@ contributors: Ron Buckton, Ecma International

    Invoking this method notifies the AsyncDisposable object that the caller does not intend to continue to use this object. This method should perform any necessary logic to perform explicit clean-up of the resource including, but not limited to, file system handles, streams, host objects, etc. When an exception is thrown from this method, it typically means that the resource could not be explicitly freed. An AsyncDisposable object is not considered "disposed" until the resulting Promise has been fulfilled.

    If called more than once on the same object, the function should not throw an exception. However, this requirement is not enforced.

    -

    When using an AsyncDisposable object, it is good practice to create the instance with a `using await` declaration, as the resource will be automatically disposed when the |Block| or |Module| immediately containing the declaration has been evaluated.

    +

    When using an AsyncDisposable object, it is good practice to create the instance with a `await using` declaration, as the resource will be automatically disposed when the |Block| or |Module| immediately containing the declaration has been evaluated.