Skip to content

Commit

Permalink
Normative: add #x in obj syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 27, 2021
1 parent 775a6d7 commit 37b4f60
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec.html
Expand Up @@ -7898,6 +7898,7 @@ <h1>Static Semantics: IsFunctionDefinition</h1>
RelationalExpression `&gt;=` ShiftExpression
RelationalExpression `instanceof` ShiftExpression
RelationalExpression `in` ShiftExpression
PrivateIdentifier `in` ShiftExpression

EqualityExpression :
EqualityExpression `==` RelationalExpression
Expand Down Expand Up @@ -8643,6 +8644,7 @@ <h1>Static Semantics: AssignmentTargetType</h1>
RelationalExpression `&gt;=` ShiftExpression
RelationalExpression `instanceof` ShiftExpression
RelationalExpression `in` ShiftExpression
PrivateIdentifier `in` ShiftExpression

EqualityExpression :
EqualityExpression `==` RelationalExpression
Expand Down Expand Up @@ -17210,6 +17212,7 @@ <h2>Syntax</h2>
RelationalExpression[?In, ?Yield, ?Await] `&gt;=` ShiftExpression[?Yield, ?Await]
RelationalExpression[?In, ?Yield, ?Await] `instanceof` ShiftExpression[?Yield, ?Await]
[+In] RelationalExpression[+In, ?Yield, ?Await] `in` ShiftExpression[?Yield, ?Await]
[+In] PrivateIdentifier `in` ShiftExpression[?Yield, ?Await]
</emu-grammar>
<emu-note>
<p>The <sub>[In]</sub> grammar parameter is needed to avoid confusing the `in` operator in a relational expression with the `in` operator in a `for` statement.</p>
Expand Down Expand Up @@ -17274,6 +17277,23 @@ <h1>Runtime Semantics: Evaluation</h1>
1. If Type(_rval_) is not Object, throw a *TypeError* exception.
1. Return ? HasProperty(_rval_, ? ToPropertyKey(_lval_)).
</emu-alg>
<emu-grammar>RelationalExpression : PrivateIdentifier `in` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _privateIdentifier_ be the StringValue of |PrivateIdentifier|.
1. Let _rref_ be the result of evaluating |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. If Type(_rval_) is not Object, throw a *TypeError* exception.
1. Let _env_ be the running execution context's PrivateEnvironment.
1. Let _privateNameBinding_ be ? ResolveBinding(_privateIdentifier_, _env_).
1. Let _privateName_ be ? GetValue(_privateNameBinding_).
1. Assert: _privateName_ is a Private Name.
1. If _privateName_.[[Kind]] is *"field"*,
1. If ! PrivateFieldFind(_privateName_, _rval_) is not ~empty~, then return *true*.
1. Else,
1. Assert: _privateName_.[[Kind]] is *"method"* or *"accessor"*.
1. If PrivateBrandCheck(_rval_, _privateName_) is not an abrupt completion, then return *true*.
1. Return *false*.
</emu-alg>
</emu-clause>

<emu-clause id="sec-instanceofoperator" aoid="InstanceofOperator">
Expand Down Expand Up @@ -21234,6 +21254,12 @@ <h1>Static Semantics: AllPrivateIdentifiersValid</h1>
1. Return AllPrivateIdentifiersValid of |ClassElementList| with argument _newNames_.
</emu-alg>

<emu-grammar>RelationalExpression : PrivateIdentifier `in` ShiftExpression</emu-grammar>
<emu-alg>
1. If StringValue of |PrivateIdentifier| is in _names_, return *true*.
1. Return *false*.
</emu-alg>

<p>For all other grammatical productions, recurse on subexpressions/substatements, passing in the _names_ of the caller. If all pieces return *true*, then return *true*. If any returns *false*, return *false*.</p>
</emu-clause>

Expand Down Expand Up @@ -22080,6 +22106,7 @@ <h1>Expression Rules</h1>
RelationalExpression `&gt;=` ShiftExpression
RelationalExpression `instanceof` ShiftExpression
RelationalExpression `in` ShiftExpression
PrivateIdentifier `in` ShiftExpression

ShiftExpression :
ShiftExpression `&lt;&lt;` AdditiveExpression
Expand Down Expand Up @@ -41234,6 +41261,7 @@ <h1>Expressions</h1>
<emu-prodref name="DestructuringAssignmentTarget"></emu-prodref>
<p>&nbsp;</p>
<emu-prodref name="Expression"></emu-prodref>
<emu-prodref name="RelationalExpression"></emu-prodref>
</emu-annex>

<emu-annex id="sec-statements">
Expand Down

0 comments on commit 37b4f60

Please sign in to comment.