From 55ad6814e69648513378b92d8730879ba25a4271 Mon Sep 17 00:00:00 2001
From: Daniel Rosenwasser
Date: Thu, 11 Jul 2019 22:23:37 -0700
Subject: [PATCH 1/7] Give nullish coalescing lower precedence than logical OR.
---
spec.html | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/spec.html b/spec.html
index 7222f19..c03c66e 100644
--- a/spec.html
+++ b/spec.html
@@ -22,10 +22,25 @@ Introduction
Syntax
+ ConditionalExpression[In, Yield, Await] :
+ LogicalORExpression[?In, ?Yield, ?Await]
+ LogicalORExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[?In, ?Yield, ?Await]
+ NullishExpression[?In, ?Yield, ?Await]
+ NullishExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[+In, ?Yield, ?Await]
+
+
+ NullishExpression[In, Yield, Await] :
+ LogicalORExpression[?In, ?Yield, ?Await]
+ LogicalORExpression[?In, ?Yield, ?Await] `??` NullishExpression[?In, ?Yield, ?Await]
+
+
LogicalORExpression[In, Yield, Await] :
LogicalANDExpression[?In, ?Yield, ?Await]
LogicalORExpression[?In, ?Yield, ?Await] `||` LogicalANDExpression[?In, ?Yield, ?Await]
- LogicalORExpression[?In, ?Yield, ?Await] `??` LogicalANDExpression[?In, ?Yield, ?Await]
+
+ LogicalANDExpression[In, Yield, Await] :
+ BitwiseORExpression[?In, ?Yield, ?Await]
+ LogicalANDExpression[?In, ?Yield, ?Await] `&&` BitwiseORExpression[?In, ?Yield, ?Await]
From 545e3437d9c19c16bc30df9325db1a07c7b81400 Mon Sep 17 00:00:00 2001
From: Daniel Rosenwasser
Date: Fri, 12 Jul 2019 00:00:53 -0700
Subject: [PATCH 2/7] Fixed associativity of NullishExpression, omitted
unnecessary productions.
---
spec.html | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/spec.html b/spec.html
index c03c66e..6d2cce0 100644
--- a/spec.html
+++ b/spec.html
@@ -31,16 +31,8 @@ Syntax
NullishExpression[In, Yield, Await] :
LogicalORExpression[?In, ?Yield, ?Await]
- LogicalORExpression[?In, ?Yield, ?Await] `??` NullishExpression[?In, ?Yield, ?Await]
+ NullishExpression[?In, ?Yield, ?Await] `??` LogicalORExpression[?In, ?Yield, ?Await]
-
- LogicalORExpression[In, Yield, Await] :
- LogicalANDExpression[?In, ?Yield, ?Await]
- LogicalORExpression[?In, ?Yield, ?Await] `||` LogicalANDExpression[?In, ?Yield, ?Await]
-
- LogicalANDExpression[In, Yield, Await] :
- BitwiseORExpression[?In, ?Yield, ?Await]
- LogicalANDExpression[?In, ?Yield, ?Await] `&&` BitwiseORExpression[?In, ?Yield, ?Await]
From 46f9a4e62e69f467770efa13af9aee834be2cf4b Mon Sep 17 00:00:00 2001
From: Daniel Rosenwasser
Date: Fri, 12 Jul 2019 12:03:37 -0700
Subject: [PATCH 3/7] Updated all sites of ConditionalExpression,
LogicalORExpression, NullishExpression.
---
spec.html | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 157 insertions(+)
diff --git a/spec.html b/spec.html
index 6d2cce0..c9f32e2 100644
--- a/spec.html
+++ b/spec.html
@@ -49,3 +49,160 @@ Runtime Semantics: Evaluation
1. Otherwise, return _lval_.
+
+
+ Binary Logical Operators
+ Syntax
+
+
+ NullishExpression[In, Yield, Await] :
+ LogicalORExpression[?In, ?Yield, ?Await]
+ NullishExpression[?In, ?Yield, ?Await] `??` LogicalORExpression[?In, ?Yield, ?Await]
+
+
+
+
+ Static Semantics: IsFunctionDefinition
+
+
+ LogicalANDExpression : LogicalANDExpression `&&` BitwiseORExpression
+
+ LogicalORExpression : LogicalORExpression `||` LogicalANDExpression
+
+ NullishExpression : NullishExpression `??` LogicalORExpression
+
+
+ 1. Return *false*.
+
+
+
+
+ Static Semantics: AssignmentTargetType
+
+
+ LogicalANDExpression : LogicalANDExpression `&&` BitwiseORExpression
+
+ LogicalORExpression : LogicalORExpression `||` LogicalANDExpression
+
+ NullishExpression : NullishExpression `??` LogicalORExpression
+
+
+ 1. Return ~invalid~.
+
+
+
+
+ Runtime Semantics: Evaluation
+
+ NullishExpression : NullishExpression `??` LogicalORExpression
+
+
+ 1. Let _lref_ be the result of evaluating |LogicalORExpression|.
+ 1. Let _lval_ be ? GetValue(_lref_).
+ 1. If _lval_ is *undefined* or *null*,
+ 1. Let _rref_ be the result of evaluating |LogicalANDExpression|.
+ 1. Return ? GetValue(_rref_).
+ 1. Otherwise, return _lval_.
+
+
+
+
+
+
+ Conditional Operator ( `? :` )
+ Syntax
+
+ ConditionalExpression[In, Yield, Await] :
+ LogicalORExpression[?In, ?Yield, ?Await]
+ LogicalORExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[?In, ?Yield, ?Await]
+ NullishExpression[?In, ?Yield, ?Await]
+ NullishExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[+In, ?Yield, ?Await]
+
+
+
+ Static Semantics: IsFunctionDefinition
+
+
+ ConditionalExpression : LogicalORExpression `?` AssignmentExpression `:` AssignmentExpression
+ ConditionalExpression : NullishExpression `?` AssignmentExpression `:` AssignmentExpression
+
+
+ 1. Return *false*.
+
+
+
+
+ Static Semantics: AssignmentTargetType
+
+
+ ConditionalExpression : LogicalORExpression `?` AssignmentExpression `:` AssignmentExpression
+ ConditionalExpression : NullishExpression `?` AssignmentExpression `:` AssignmentExpression
+
+
+ 1. Return ~invalid~.
+
+
+
+
+ Runtime Semantics: Evaluation
+
+ ConditionalExpression : LogicalORExpression `?` AssignmentExpression `:` AssignmentExpression
+ ConditionalExpression : NullishExpression `?` AssignmentExpression `:` AssignmentExpression
+
+
+ 1. Let _lref_ be the result of evaluating |LogicalORExpression|.
+ 1. Let _lref_ be the result of evaluating |NullishExpression|.
+ 1. Let _lval_ be ToBoolean(? GetValue(_lref_)).
+ 1. If _lval_ is *true*, then
+ 1. Let _trueRef_ be the result of evaluating the first |AssignmentExpression|.
+ 1. Return ? GetValue(_trueRef_).
+ 1. Else,
+ 1. Let _falseRef_ be the result of evaluating the second |AssignmentExpression|.
+ 1. Return ? GetValue(_falseRef_).
+
+
+
+
+
+ Tail Position Calls
+
+
+ Static Semantics: HasCallInTailPosition
+ With parameter _call_.
+
+
+ Expression Rules
+
+ ConditionalExpression : LogicalORExpression `?` AssignmentExpression `:` AssignmentExpression
+ ConditionalExpression : NullishExpression `?` AssignmentExpression `:` AssignmentExpression
+
+
+ 1. Let _has_ be HasCallInTailPosition of the first |AssignmentExpression| with argument _call_.
+ 1. If _has_ is *true*, return *true*.
+ 1. Return HasCallInTailPosition of the second |AssignmentExpression| with argument _call_.
+
+
+ ConditionalExpression : LogicalORExpression `?` AssignmentExpression `:` AssignmentExpression
+ ConditionalExpression : NullishExpression `?` AssignmentExpression `:` AssignmentExpression
+
+ LogicalANDExpression : LogicalANDExpression `&&` BitwiseORExpression
+
+ 1. Return HasCallInTailPosition of |BitwiseORExpression| with argument _call_.
+
+ LogicalORExpression : LogicalORExpression `||` LogicalANDExpression
+
+ 1. Return HasCallInTailPosition of |LogicalANDExpression| with argument _call_.
+
+
+
+ NullishExpression : NullishExpression `??` LogicalORExpression
+
+
+
+
+ 1. Return HasCallInTailPosition of |LogicalORExpression| with argument _call_.
+
+
+
+
+
\ No newline at end of file
From fa4301985abcf956546c08ab88c70ba418ac97df Mon Sep 17 00:00:00 2001
From: Daniel Rosenwasser
Date: Fri, 12 Jul 2019 16:36:42 -0700
Subject: [PATCH 4/7] Remove duplicated spec text.
---
spec.html | 32 --------------------------------
1 file changed, 32 deletions(-)
diff --git a/spec.html b/spec.html
index c9f32e2..dd00f16 100644
--- a/spec.html
+++ b/spec.html
@@ -18,38 +18,6 @@ Introduction
-
- Syntax
-
-
- ConditionalExpression[In, Yield, Await] :
- LogicalORExpression[?In, ?Yield, ?Await]
- LogicalORExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[?In, ?Yield, ?Await]
- NullishExpression[?In, ?Yield, ?Await]
- NullishExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[+In, ?Yield, ?Await]
-
-
- NullishExpression[In, Yield, Await] :
- LogicalORExpression[?In, ?Yield, ?Await]
- NullishExpression[?In, ?Yield, ?Await] `??` LogicalORExpression[?In, ?Yield, ?Await]
-
-
-
-
-
- Runtime Semantics: Evaluation
-
- LogicalORExpression : LogicalORExpression `??` LogicalANDExpression
-
- 1. Let _lref_ be the result of evaluating |LogicalORExpression|.
- 1. Let _lval_ be ? GetValue(_lref_).
- 1. If _lval_ is *undefined* or *null*,
- 1. Let _rref_ be the result of evaluating |LogicalANDExpression|.
- 1. Return ? GetValue(_rref_).
- 1. Otherwise, return _lval_.
-
-
-
Binary Logical Operators
Syntax
From 57ac9675672622a3e567c86e864e0074c27a46b5 Mon Sep 17 00:00:00 2001
From: Daniel Rosenwasser
Date: Fri, 12 Jul 2019 16:39:55 -0700
Subject: [PATCH 5/7] Update intro.
---
spec.html | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/spec.html b/spec.html
index dd00f16..375f9c7 100644
--- a/spec.html
+++ b/spec.html
@@ -1,9 +1,9 @@
-title: Nullish coalescing operator
+title: Nullish Coalescing Operator
stage: 2
-contributors: Daniel Ehrenberg
+contributors: Daniel Ehrenberg, Daniel Rosenwasser
@@ -12,7 +12,7 @@ Introduction
The main design decisions made in this specification are:
- The right argument of `??` is evaluated only if needed ("short circuiting").
- - `??` has the same precedence as `||`.
+ - `??` has lower precedence than `||`.
- The right argument is selected if the left argument is `null` or `undefined`.
From 1ecbcf0daa6a97911203a12fc88397d5c0eb279b Mon Sep 17 00:00:00 2001
From: Daniel Rosenwasser
Date: Fri, 12 Jul 2019 23:02:36 -0700
Subject: [PATCH 6/7] Fixed ordered list, fixed runtime semantics.
---
spec.html | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/spec.html b/spec.html
index 375f9c7..2d05344 100644
--- a/spec.html
+++ b/spec.html
@@ -64,14 +64,12 @@ Runtime Semantics: Evaluation
NullishExpression : NullishExpression `??` LogicalORExpression
-
- 1. Let _lref_ be the result of evaluating |LogicalORExpression|.
- 1. Let _lval_ be ? GetValue(_lref_).
- 1. If _lval_ is *undefined* or *null*,
- 1. Let _rref_ be the result of evaluating |LogicalANDExpression|.
- 1. Return ? GetValue(_rref_).
- 1. Otherwise, return _lval_.
-
+ 1. Let _lref_ be the result of evaluating |NullishExpression|.
+ 1. Let _lval_ be ? GetValue(_lref_).
+ 1. If _lval_ is *undefined* or *null*,
+ 1. Let _rref_ be the result of evaluating |LogicalORExpression|.
+ 1. Return ? GetValue(_rref_).
+ 1. Otherwise, return _lval_.
From b66c7f11d759c2cde999892f3bb441f6e65ad3c9 Mon Sep 17 00:00:00 2001
From: Daniel Rosenwasser
Date: Sat, 20 Jul 2019 00:40:59 -0700
Subject: [PATCH 7/7] Newline.
---
spec.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec.html b/spec.html
index 99c0017..752d59f 100644
--- a/spec.html
+++ b/spec.html
@@ -171,4 +171,4 @@ Expression Rules
-
\ No newline at end of file
+