Skip to content

Commit

Permalink
Adding missing optional chain + private identifiers support
Browse files Browse the repository at this point in the history
  • Loading branch information
caiolima committed Apr 9, 2021
1 parent 58e26b5 commit aab4c07
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -5859,7 +5859,7 @@ <h1>PrivateFieldSet ( _P_, _O_, _value_ )</h1>
1. Perform ? PrivateBrandCheck(_O_, _P_).
1. If _P_ does not have a [[Set]] field, throw a *TypeError* exception.
1. Let _setter_ be _P_.[[Set]].
1. Perform ? Call(_setter_, _O_, &laquo; _value_ &rqauo;).
1. Perform ? Call(_setter_, _O_, &laquo; _value_ &raquo;).
</emu-alg>
</emu-clause>

Expand Down Expand Up @@ -16071,10 +16071,12 @@ <h2>Syntax</h2>
`?.` `[` Expression[+In, ?Yield, ?Await] `]`
`?.` IdentifierName
`?.` TemplateLiteral[?Yield, ?Await, +Tagged]
`?.` PrivateIdentifier
OptionalChain[?Yield, ?Await] Arguments[?Yield, ?Await]
OptionalChain[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await] `]`
OptionalChain[?Yield, ?Await] `.` IdentifierName
OptionalChain[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged]
OptionalChain[?Yield, ?Await] `.` PrivateIdentifier

LeftHandSideExpression[Yield, Await] :
NewExpression[?Yield, ?Await]
Expand Down Expand Up @@ -16528,6 +16530,12 @@ <h1>Runtime Semantics: ChainEvaluation</h1>
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
</emu-alg>
<emu-grammar>OptionalChain : `?.` PrivateIdentifier</emu-grammar>
<emu-alg>
1. Let _bv_ be ? RequireObjectCoercible(_baseValue_).
1. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|.
1. Return MakePrivateReference(_bv_, _fieldNameString_).
</emu-alg>
<emu-grammar>OptionalChain : OptionalChain Arguments</emu-grammar>
<emu-alg>
1. Let _optionalChain_ be |OptionalChain|.
Expand All @@ -16553,6 +16561,15 @@ <h1>Runtime Semantics: ChainEvaluation</h1>
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_newValue_, |IdentifierName|, _strict_).
</emu-alg>
<emu-grammar>OptionalChain : OptionalChain `.` PrivateIdentifier</emu-grammar>
<emu-alg>
1. Let _optionalChain_ be |OptionalChain|.
1. Let _newReference_ be ? ChainEvaluation of _optionalChain_ with arguments _baseValue_ and _baseReference_.
1. Let _newValue_ be ? GetValue(_newReference_).
1. Let _nv_ be ? RequireObjectCoercible(_newValue_).
1. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|.
1. Return MakePrivateReference(_nv_, _fieldNameString_).
</emu-alg>
</emu-clause>
</emu-clause>

Expand Down Expand Up @@ -16789,7 +16806,7 @@ <h1>Static Semantics: Early Errors</h1>
<emu-grammar>UnaryExpression : `delete` UnaryExpression</emu-grammar>
<ul>
<li>
It is a Syntax Error if the |UnaryExpression| is contained in strict mode code and the derived |UnaryExpression| is <emu-grammar>PrimaryExpression : IdentifierReference</emu-grammar>, <emu-grammar>MemberExpression : MemberExpression `.` PrivateIdentifier</emu-grammar>, or <emu-grammar>CallExpression : CallExpression `.` PrivateIdentifier</emu-grammar>.
It is a Syntax Error if the |UnaryExpression| is contained in strict mode code and the derived |UnaryExpression| is <emu-grammar>PrimaryExpression : IdentifierReference</emu-grammar>, <emu-grammar>MemberExpression : MemberExpression `.` PrivateIdentifier</emu-grammar>, <emu-grammar>CallExpression : CallExpression `.` PrivateIdentifier</emu-grammar>, <emu-grammar>OptionalChain : `?.` PrivateIdentifier</emu-grammar>, or <emu-grammar>OptionalChain : OptionalChain `.` PrivateIdentifier</emu-grammar>.
</li>
<li>
<p>It is a Syntax Error if the derived |UnaryExpression| is
Expand Down Expand Up @@ -21277,6 +21294,18 @@ <h1>Static Semantics: AllPrivateIdentifiersValid</h1>
1. Return *false*.
</emu-alg>

<emu-grammar>OptionalChain[Yield, Await] : `?.` PrivateIdentifier</emu-grammar>
<emu-alg>
1. If StringValue of |PrivateIdentifier| is in _names_, return *true*.
1. Return *false*.
</emu-alg>

<emu-grammar>OptionalChain[Yield, Await] : OptionalChain[?Yield, ?Await] `.` PrivateIdentifier</emu-grammar>
<emu-alg>
1. If StringValue of |PrivateIdentifier| is in _names_, return *true*.
1. Return *false*.
</emu-alg>

<emu-grammar>ClassBody : ClassElementList</emu-grammar>
<emu-alg>
1. Let _newNames_ be a copy of _names_.
Expand Down

0 comments on commit aab4c07

Please sign in to comment.