Skip to content

Commit d09532c

Browse files
codehagbakkot
authored andcommitted
Normative: Allow null or undefined in Reference Records (#2267)
Co-authored-by: codehag <yulia.startsev@gmail.com> Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
1 parent f79dfd2 commit d09532c

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

spec.html

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3974,7 +3974,7 @@ <h1>The Reference Record Specification Type</h1>
39743974
One of:
39753975
<ul>
39763976
<li>
3977-
any ECMAScript language value except *undefined* or *null*,
3977+
any ECMAScript language value,
39783978
</li>
39793979
<li>
39803980
an Environment Record, or
@@ -4018,7 +4018,7 @@ <h1>
40184018
<emu-alg>
40194019
1. Assert: _V_ is a Reference Record.
40204020
1. If _V_.[[Base]] is ~unresolvable~, return *false*.
4021-
1. If Type(_V_.[[Base]]) is Boolean, String, Symbol, BigInt, Number, or Object, return *true*; otherwise return *false*.
4021+
1. If _V_.[[Base]] is an Environment Record, return *false*; otherwise return *true*.
40224022
</emu-alg>
40234023
</emu-clause>
40244024

@@ -4077,7 +4077,7 @@ <h1>
40774077
1. If _V_ is not a Reference Record, return _V_.
40784078
1. If IsUnresolvableReference(_V_) is *true*, throw a *ReferenceError* exception.
40794079
1. If IsPropertyReference(_V_) is *true*, then
4080-
1. [id="step-getvalue-toobject"] Let _baseObj_ be ! ToObject(_V_.[[Base]]).
4080+
1. [id="step-getvalue-toobject"] Let _baseObj_ be ? ToObject(_V_.[[Base]]).
40814081
1. If IsPrivateReference(_V_) is *true*, then
40824082
1. Return ? PrivateGet(_V_.[[ReferencedName]], _baseObj_).
40834083
1. Return ? _baseObj_.[[Get]](_V_.[[ReferencedName]], GetThisValue(_V_)).
@@ -4109,7 +4109,7 @@ <h1>
41094109
1. Let _globalObj_ be GetGlobalObject().
41104110
1. Return ? Set(_globalObj_, _V_.[[ReferencedName]], _W_, *false*).
41114111
1. If IsPropertyReference(_V_) is *true*, then
4112-
1. [id="step-putvalue-toobject"] Let _baseObj_ be ! ToObject(_V_.[[Base]]).
4112+
1. [id="step-putvalue-toobject"] Let _baseObj_ be ? ToObject(_V_.[[Base]]).
41134113
1. If IsPrivateReference(_V_) is *true*, then
41144114
1. Return ? PrivateSet(_V_.[[ReferencedName]], _baseObj_, _W_).
41154115
1. Let _succeeded_ be ? _baseObj_.[[Set]](_V_.[[ReferencedName]], _W_, GetThisValue(_V_)).
@@ -18588,15 +18588,14 @@ <h1>Runtime Semantics: Evaluation</h1>
1858818588
1. Let _baseReference_ be the result of evaluating |MemberExpression|.
1858918589
1. Let _baseValue_ be ? GetValue(_baseReference_).
1859018590
1. If the code matched by this |MemberExpression| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
18591-
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
18591+
1. Return ! EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
1859218592
</emu-alg>
1859318593
<emu-grammar>MemberExpression : MemberExpression `.` PrivateIdentifier</emu-grammar>
1859418594
<emu-alg>
1859518595
1. Let _baseReference_ be the result of evaluating |MemberExpression|.
1859618596
1. Let _baseValue_ be ? GetValue(_baseReference_).
18597-
1. Let _bv_ be ? RequireObjectCoercible(_baseValue_).
1859818597
1. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|.
18599-
1. Return ! MakePrivateReference(_bv_, _fieldNameString_).
18598+
1. Return ! MakePrivateReference(_baseValue_, _fieldNameString_).
1860018599
</emu-alg>
1860118600
<emu-grammar>CallExpression : CallExpression `[` Expression `]`</emu-grammar>
1860218601
<emu-alg>
@@ -18610,15 +18609,14 @@ <h1>Runtime Semantics: Evaluation</h1>
1861018609
1. Let _baseReference_ be the result of evaluating |CallExpression|.
1861118610
1. Let _baseValue_ be ? GetValue(_baseReference_).
1861218611
1. If the code matched by this |CallExpression| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
18613-
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
18612+
1. Return ! EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
1861418613
</emu-alg>
1861518614
<emu-grammar>CallExpression : CallExpression `.` PrivateIdentifier</emu-grammar>
1861618615
<emu-alg>
1861718616
1. Let _baseReference_ be the result of evaluating |CallExpression|.
1861818617
1. Let _baseValue_ be ? GetValue(_baseReference_).
18619-
1. Let _bv_ be ? RequireObjectCoercible(_baseValue_).
1862018618
1. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|.
18621-
1. Return ! MakePrivateReference(_bv_, _fieldNameString_).
18619+
1. Return ! MakePrivateReference(_baseValue_, _fieldNameString_).
1862218620
</emu-alg>
1862318621
</emu-clause>
1862418622
</emu-clause>
@@ -18636,9 +18634,8 @@ <h1>
1863618634
<emu-alg>
1863718635
1. Let _propertyNameReference_ be the result of evaluating _expression_.
1863818636
1. Let _propertyNameValue_ be ? GetValue(_propertyNameReference_).
18639-
1. Let _bv_ be ? RequireObjectCoercible(_baseValue_).
1864018637
1. Let _propertyKey_ be ? ToPropertyKey(_propertyNameValue_).
18641-
1. Return the Reference Record { [[Base]]: _bv_, [[ReferencedName]]: _propertyKey_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }.
18638+
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyKey_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }.
1864218639
</emu-alg>
1864318640
</emu-clause>
1864418641
<emu-clause id="sec-evaluate-property-access-with-identifier-key" type="abstract operation" oldids="sec-evaluate-identifier-key-property-access">
@@ -18653,9 +18650,8 @@ <h1>
1865318650
</dl>
1865418651
<emu-alg>
1865518652
1. Assert: _identifierName_ is an |IdentifierName|.
18656-
1. Let _bv_ be ? RequireObjectCoercible(_baseValue_).
1865718653
1. Let _propertyNameString_ be StringValue of _identifierName_.
18658-
1. Return the Reference Record { [[Base]]: _bv_, [[ReferencedName]]: _propertyNameString_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }.
18654+
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyNameString_, [[Strict]]: _strict_, [[ThisValue]]: ~empty~ }.
1865918655
</emu-alg>
1866018656
</emu-clause>
1866118657

@@ -18833,8 +18829,7 @@ <h1>
1883318829
1. Let _env_ be GetThisEnvironment().
1883418830
1. Assert: _env_.HasSuperBinding() is *true*.
1883518831
1. Let _baseValue_ be ? _env_.GetSuperBase().
18836-
1. Let _bv_ be ? RequireObjectCoercible(_baseValue_).
18837-
1. Return the Reference Record { [[Base]]: _bv_, [[ReferencedName]]: _propertyKey_, [[Strict]]: _strict_, [[ThisValue]]: _actualThis_ }.
18832+
1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _propertyKey_, [[Strict]]: _strict_, [[ThisValue]]: _actualThis_ }.
1883818833
1. NOTE: This returns a Super Reference Record.
1883918834
</emu-alg>
1884018835
</emu-clause>
@@ -18968,13 +18963,12 @@ <h1>Runtime Semantics: ChainEvaluation</h1>
1896818963
<emu-grammar>OptionalChain : `?.` IdentifierName</emu-grammar>
1896918964
<emu-alg>
1897018965
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
18971-
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
18966+
1. Return ! EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
1897218967
</emu-alg>
1897318968
<emu-grammar>OptionalChain : `?.` PrivateIdentifier</emu-grammar>
1897418969
<emu-alg>
18975-
1. Let _bv_ be ? RequireObjectCoercible(_baseValue_).
1897618970
1. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|.
18977-
1. Return ! MakePrivateReference(_bv_, _fieldNameString_).
18971+
1. Return ! MakePrivateReference(_baseValue_, _fieldNameString_).
1897818972
</emu-alg>
1897918973
<emu-grammar>OptionalChain : OptionalChain Arguments</emu-grammar>
1898018974
<emu-alg>
@@ -18999,16 +18993,15 @@ <h1>Runtime Semantics: ChainEvaluation</h1>
1899918993
1. Let _newReference_ be ? ChainEvaluation of _optionalChain_ with arguments _baseValue_ and _baseReference_.
1900018994
1. Let _newValue_ be ? GetValue(_newReference_).
1900118995
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
19002-
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_newValue_, |IdentifierName|, _strict_).
18996+
1. Return ! EvaluatePropertyAccessWithIdentifierKey(_newValue_, |IdentifierName|, _strict_).
1900318997
</emu-alg>
1900418998
<emu-grammar>OptionalChain : OptionalChain `.` PrivateIdentifier</emu-grammar>
1900518999
<emu-alg>
1900619000
1. Let _optionalChain_ be |OptionalChain|.
1900719001
1. Let _newReference_ be ? ChainEvaluation of _optionalChain_ with arguments _baseValue_ and _baseReference_.
1900819002
1. Let _newValue_ be ? GetValue(_newReference_).
19009-
1. Let _nv_ be ? RequireObjectCoercible(_newValue_).
1901019003
1. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|.
19011-
1. Return ! MakePrivateReference(_nv_, _fieldNameString_).
19004+
1. Return ! MakePrivateReference(_newValue_, _fieldNameString_).
1901219005
</emu-alg>
1901319006
</emu-clause>
1901419007
</emu-clause>
@@ -19288,7 +19281,7 @@ <h1>Runtime Semantics: Evaluation</h1>
1928819281
1. If IsPropertyReference(_ref_) is *true*, then
1928919282
1. Assert: ! IsPrivateReference(_ref_) is *false*.
1929019283
1. If IsSuperReference(_ref_) is *true*, throw a *ReferenceError* exception.
19291-
1. [id="step-delete-operator-toobject"] Let _baseObj_ be ! ToObject(_ref_.[[Base]]).
19284+
1. [id="step-delete-operator-toobject"] Let _baseObj_ be ? ToObject(_ref_.[[Base]]).
1929219285
1. Let _deleteStatus_ be ? _baseObj_.[[Delete]](_ref_.[[ReferencedName]]).
1929319286
1. If _deleteStatus_ is *false* and _ref_.[[Strict]] is *true*, throw a *TypeError* exception.
1929419287
1. Return _deleteStatus_.

0 commit comments

Comments
 (0)