Skip to content

Commit a060ea8

Browse files
committed
Normative: add #x in obj syntax (#2290)
See tc39/proposal-private-fields-in-in#7
1 parent 7a79833 commit a060ea8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spec.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7690,6 +7690,7 @@ <h1>Static Semantics: IsFunctionDefinition</h1>
76907690
RelationalExpression `&gt;=` ShiftExpression
76917691
RelationalExpression `instanceof` ShiftExpression
76927692
RelationalExpression `in` ShiftExpression
7693+
PrivateIdentifier `in` ShiftExpression
76937694

76947695
EqualityExpression :
76957696
EqualityExpression `==` RelationalExpression
@@ -8438,6 +8439,7 @@ <h1>Static Semantics: AssignmentTargetType</h1>
84388439
RelationalExpression `&gt;=` ShiftExpression
84398440
RelationalExpression `instanceof` ShiftExpression
84408441
RelationalExpression `in` ShiftExpression
8442+
PrivateIdentifier `in` ShiftExpression
84418443

84428444
EqualityExpression :
84438445
EqualityExpression `==` RelationalExpression
@@ -17119,6 +17121,7 @@ <h2>Syntax</h2>
1711917121
RelationalExpression[?In, ?Yield, ?Await] `&gt;=` ShiftExpression[?Yield, ?Await]
1712017122
RelationalExpression[?In, ?Yield, ?Await] `instanceof` ShiftExpression[?Yield, ?Await]
1712117123
[+In] RelationalExpression[+In, ?Yield, ?Await] `in` ShiftExpression[?Yield, ?Await]
17124+
[+In] PrivateIdentifier `in` ShiftExpression[?Yield, ?Await]
1712217125
</emu-grammar>
1712317126
<emu-note>
1712417127
<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>
@@ -17179,6 +17182,17 @@ <h1>Runtime Semantics: Evaluation</h1>
1717917182
1. If Type(_rval_) is not Object, throw a *TypeError* exception.
1718017183
1. Return ? HasProperty(_rval_, ? ToPropertyKey(_lval_)).
1718117184
</emu-alg>
17185+
<emu-grammar>RelationalExpression : PrivateIdentifier `in` ShiftExpression</emu-grammar>
17186+
<emu-alg>
17187+
1. Let _privateIdentifier_ be the StringValue of |PrivateIdentifier|.
17188+
1. Let _rref_ be the result of evaluating |ShiftExpression|.
17189+
1. Let _rval_ be ? GetValue(_rref_).
17190+
1. If Type(_rval_) is not Object, throw a *TypeError* exception.
17191+
1. Let _privateEnv_ be the running execution context's PrivateEnvironment.
17192+
1. Let _privateName_ be ! ResolvePrivateIdentifier(_privateEnv_, _privateIdentifier_).
17193+
1. If ! PrivateElementFind(_privateName_, _rval_) is not ~empty~, return *true*.
17194+
1. Return *false*.
17195+
</emu-alg>
1718217196
</emu-clause>
1718317197

1718417198
<emu-clause id="sec-instanceofoperator" aoid="InstanceofOperator">
@@ -21223,6 +21237,13 @@ <h1>Static Semantics: AllPrivateIdentifiersValid</h1>
2122321237
1. Append to _newNames_ the elements of PrivateBoundIdentifiers of |ClassBody|.
2122421238
1. Return AllPrivateIdentifiersValid of |ClassElementList| with argument _newNames_.
2122521239
</emu-alg>
21240+
21241+
<emu-grammar>RelationalExpression : PrivateIdentifier `in` ShiftExpression</emu-grammar>
21242+
<emu-alg>
21243+
1. If _names_ contains the StringValue of |PrivateIdentifier|, then
21244+
1. Return AllPrivateIdentifiersValid of |ShiftExpression| with argument _names_.
21245+
1. Return *false*.
21246+
</emu-alg>
2122621247
</emu-clause>
2122721248

2122821249
<emu-clause id="sec-static-semantics-privateboundidentifiers" type="sdo" aoid="PrivateBoundIdentifiers">
@@ -22085,6 +22106,7 @@ <h1>Expression Rules</h1>
2208522106
RelationalExpression `&gt;=` ShiftExpression
2208622107
RelationalExpression `instanceof` ShiftExpression
2208722108
RelationalExpression `in` ShiftExpression
22109+
PrivateIdentifier `in` ShiftExpression
2208822110

2208922111
ShiftExpression :
2209022112
ShiftExpression `&lt;&lt;` AdditiveExpression

0 commit comments

Comments
 (0)