Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Give nullish coalescing lower precedence than logical OR. #40

Closed
21 changes: 5 additions & 16 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ <h1>Introduction</h1>
<ol>
<li>The right argument of `??` is evaluated only if needed ("short circuiting").</li>
<li>`??` has lower precedence than `||`.</li>
<li>`??` cannot immediately contain, or be contained within, an `&amp;&amp;` or `||` operation.</li>
<li>The right argument is selected if the left argument is `null` or `undefined`.</li>
</ol>
</p>
Expand All @@ -24,20 +23,10 @@ <h1>Binary Logical Operators</h1>
<h2>Syntax</h2>
<emu-grammar type="definition">
<ins>
CoalesceExpression[In, Yield, Await, Coalesced] :
LogicalORExpression[?In, ?Yield, ?Await, ?Coalesced]
CoalesceExpression[?In, ?Yield, ?Await, +Coalesced] `??` LogicalORExpression[?In, ?Yield, ?Await, +Coalesced]
CoalesceExpression[In, Yield, Await] :
LogicalORExpression[?In, ?Yield, ?Await]
CoalesceExpression[?In, ?Yield, ?Await] `??` LogicalORExpression[?In, ?Yield, ?Await]
</ins>

LogicalORExpression[In, Yield, Await, <ins>Coalesced</ins>] :
LogicalANDExpression[?In, ?Yield, ?Await, <ins>?Coalesced</ins>]
<del>LogicalORExpression[?In, ?Yield, ?Await] `||` LogicalANDExpression[?In, ?Yield, ?Await]</del>
<ins>[~Coalesced] LogicalORExpression[?In, ?Yield, ?Await, ~Coalesced] `||` LogicalANDExpression[?In, ?Yield, ?Await, ~Coalesced]</ins>

LogicalANDExpression[In, Yield, Await, <ins>Coalesced</ins>] :
BitwiseORExpression[?In, ?Yield, ?Await]
<del>LogicalANDExpression[?In, ?Yield, ?Await] `&amp;&amp;` BitwiseORExpression[?In, ?Yield, ?Await]</del>
<ins>[~Coalesced] LogicalANDExpression[?In, ?Yield, ?Await, ~Coalesced] `&amp;&amp;` BitwiseORExpression[?In, ?Yield, ?Await]</ins>
</emu-grammar>

<emu-clause id="sec-binary-logical-operators-static-semantics-isfunctiondefinition">
Expand Down Expand Up @@ -95,8 +84,8 @@ <h2>Syntax</h2>
LogicalORExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[?In, ?Yield, ?Await]
</del>
<ins>
CoalesceExpression[?In, ?Yield, ?Await, ~Coalesced]
CoalesceExpression[?In, ?Yield, ?Await, ~Coalesced] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[+In, ?Yield, ?Await]
CoalesceExpression[?In, ?Yield, ?Await]
CoalesceExpression[?In, ?Yield, ?Await] `?` AssignmentExpression[+In, ?Yield, ?Await] `:` AssignmentExpression[+In, ?Yield, ?Await]
</ins>
</emu-grammar>

Expand Down