diff --git a/spec.emu b/spec.emu index 35f5ab1..672f3e6 100644 --- a/spec.emu +++ b/spec.emu @@ -69,12 +69,12 @@ contributors: Ron Buckton, Ecma International `delete` UnaryExpression `void` UnaryExpression `typeof` UnaryExpression - `throw` UnaryExpression `+` UnaryExpression `-` UnaryExpression `~` UnaryExpression `!` UnaryExpression AwaitExpression + ThrowExpression ExponentiationExpression : UpdateExpression `**` ExponentiationExpression @@ -253,12 +253,12 @@ contributors: Ron Buckton, Ecma International `delete` UnaryExpression `void` UnaryExpression `typeof` UnaryExpression - `throw` UnaryExpression `+` UnaryExpression `-` UnaryExpression `~` UnaryExpression `!` UnaryExpression AwaitExpression + ThrowExpression ExponentiationExpression : UpdateExpression `**` ExponentiationExpression @@ -328,6 +328,45 @@ contributors: Ron Buckton, Ecma International 1. Return ~invalid~. + + + +

Static Semantics: ContainsThrowOnRight ( ): a Boolean

+
+
+ ThrowExpression : `throw` UnaryExpression + + 1. Return *true*. + + + UpdateExpression : + LeftHandSideExpression + LeftHandSideExpression `++` + LeftHandSideExpression `--` + + + 1. Return *false*. + + + ExponentiationExpression : + UpdateExpression `**` ExponentiationExpression + + MultiplicativeExpression : + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + + 1. Return ContainsThrowOnRight of |ExponentiationExpression|. + + + AdditiveExpression : + AdditiveExpression `+` MultiplicativeExpression + AdditiveExpression `-` MultiplicativeExpression + + + 1. Return ContainsThrowOnRight of |MultiplicativeExpression|. + +
+
@@ -343,30 +382,158 @@ contributors: Ron Buckton, Ecma International `delete` UnaryExpression[?Yield, ?Await] `void` UnaryExpression[?Yield, ?Await] `typeof` UnaryExpression[?Yield, ?Await] - `throw` UnaryExpression[?Yield, ?Await] [lookahead ∉ ThrowExpressionInvalidPunctuator] `+` UnaryExpression[?Yield, ?Await] `-` UnaryExpression[?Yield, ?Await] `~` UnaryExpression[?Yield, ?Await] `!` UnaryExpression[?Yield, ?Await] [+Await] AwaitExpression[?Yield] - - - ThrowExpressionInvalidPunctuator : one of `,` `<` `>` `<=` `>=` `==` `!=` `===` `!==` `+` `-` `*` `/` `%` `**` `<<` `>>` `>>>` `&` `|` `^` `&&` `||` `??` `=` `+=` `-=` `*=` `/=` `%=` `**=` `<<=` `>>=` `>>>=` `&=` `|=` `^=` `&&=` `||=` `??=` `?` - + ThrowExpression[?Yield, ?Await] + + + +

The `throw` Operator

+

Syntax

+ + ThrowExpression[Yield, Await] : + `throw` UnaryExpression[?Yield, ?Await] [lookahead ∉ ThrowExpressionInvalidPunctuator] + + ThrowExpressionInvalidPunctuator : one of `,` `<` `>` `<=` `>=` `==` `!=` `===` `!==` `*` `%` `**` `<<` `>>` `>>>` `&` `|` `^` `&&` `||` `??` `?` + + + +

Runtime Semantics: Evaluation

+ ThrowExpression : `throw` UnaryExpression + + 1. Let _exprRef_ be ? Evaluation of |UnaryExpression|. + 1. Let _exprValue_ be ? GetValue(_exprRef_). + 1. Return ThrowCompletion(_exprValue_). + +
+
+
- -

The `throw` Operator

- -

Runtime Semantics: Evaluation

- UnaryExpression : `throw` UnaryExpression - - 1. Let _exprRef_ be ? Evaluation of |UnaryExpression|. - 1. Let _exprValue_ be ? GetValue(_exprRef_). - 1. Return ThrowCompletion(_exprValue_). - + +

Multiplicative Operators

+ + +

Static Semantics

+ +

Static Semantics: Early Errors

+ + MultiplicativeExpression : + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + +
    +
  • + It is a Syntax Error if the source text matched by |MultiplicativeOperator| is `/` and ContainsThrowOnRight of |MultiplicativeExpression| is *true*. +
  • +
+ +

This production exists in order to prevent automatic semicolon insertion rules () from being applied to the following code:

+

+            a ?? throw b
+            /c/d
+          
+

so that it would be interpreted as two valid statements. The purpose is to maintain consistency with similar code using |ThrowStatement|:

+

+            throw b
+            /c/d
+          
+

which is a valid statement and where automatic semicolon insertion does not apply.

+
+
+
+
+
+ + +

Additive Operators

+ + +

Static Semantics

+ +

Static Semantics: Early Errors

+ + AdditiveExpression : + AdditiveExpression `+` MultiplicativeExpression + AdditiveExpression `-` MultiplicativeExpression + +
    +
  • + It is a Syntax Error if ContainsThrowOnRight of |AdditiveExpression| is *true*. +
  • +
+ +

This production exists in order to prevent automatic semicolon insertion rules () from being applied to the following code:

+

+            a ?? throw b
+            + c
+          
+

so that it would be interpreted as two valid statements. The purpose is to maintain consistency with similar code using |ThrowStatement|:

+

+            throw b
+            + c
+          
+

which is a valid statement and where automatic semicolon insertion does not apply.

+
+
+
+
+
+ + +

Assignment Operators

+

Syntax

+ + AssignmentExpression[In, Yield, Await] : + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield] YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] `=` AssignmentExpression[?In, ?Yield, ?Await] #assignment + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] `&&=` AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] `||=` AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] `??=` AssignmentExpression[?In, ?Yield, ?Await] + ThrowExpression[?Yield, ?Await] `/=` AssignmentExpression[?In, ?Yield, ?Await] + + // emu-format ignore + AssignmentOperator : one of + `*=` `/=` `%=` `+=` `-=` `<<=` `>>=` `>>>=` `&=` `^=` `|=` `**=` + + + + +

Static Semantics

+ +

Static Semantics: Early Errors

+ + AssignmentExpression : + ThrowExpression `/=` AssignmentExpression + +
    +
  • + It is a Syntax Error if any source text is matched by this production. +
  • +
+ +

This production exists in order to prevent automatic semicolon insertion rules () from being applied to the following code:

+

+            a = throw b
+            /= c / d
+          
+

so that it would be interpreted as two valid statements. The purpose is to maintain consistency with similar code using |ThrowStatement|:

+

+            throw b
+            /= c / d
+          
+

which is a valid statement and where automatic semicolon insertion does not apply.

+
+
+