Skip to content

Commit f8ea1ac

Browse files
shvaikaleshljharb
authored andcommitted
Editorial: Explicitly unwrap results of IsAccessorDescriptor (#1559)
1 parent 090334c commit f8ea1ac

File tree

1 file changed

+61
-31
lines changed

1 file changed

+61
-31
lines changed

spec.html

Lines changed: 61 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3210,7 +3210,8 @@ <h1>GetValue ( _V_ )</h1>
32103210
1. Assert: In this case, _base_ will never be *undefined* or *null*.
32113211
1. Set _base_ to ! ToObject(_base_).
32123212
1. Return ? _base_.[[Get]](GetReferencedName(_V_), GetThisValue(_V_)).
3213-
1. Else _base_ must be an Environment Record,
3213+
1. Else,
3214+
1. Assert: _base_ is an Environment Record.
32143215
1. Return ? _base_.GetBindingValue(GetReferencedName(_V_), IsStrictReference(_V_)) (see <emu-xref href="#sec-environment-records"></emu-xref>).
32153216
</emu-alg>
32163217
<emu-note>
@@ -3237,7 +3238,8 @@ <h1>PutValue ( _V_, _W_ )</h1>
32373238
1. Let _succeeded_ be ? _base_.[[Set]](GetReferencedName(_V_), _W_, GetThisValue(_V_)).
32383239
1. If _succeeded_ is *false* and IsStrictReference(_V_) is *true*, throw a *TypeError* exception.
32393240
1. Return.
3240-
1. Else _base_ must be an Environment Record,
3241+
1. Else,
3242+
1. Assert: _base_ is an Environment Record.
32413243
1. Return ? _base_.SetMutableBinding(GetReferencedName(_V_), _W_, IsStrictReference(_V_)) (see <emu-xref href="#sec-environment-records"></emu-xref>).
32423244
</emu-alg>
32433245
<emu-note>
@@ -3478,7 +3480,9 @@ <h1>ToPrimitive ( _input_ [ , _PreferredType_ ] )</h1>
34783480
1. If Type(_input_) is Object, then
34793481
1. If _PreferredType_ is not present, let _hint_ be `"default"`.
34803482
1. Else if _PreferredType_ is hint String, let _hint_ be `"string"`.
3481-
1. Else _PreferredType_ is hint Number, let _hint_ be `"number"`.
3483+
1. Else,
3484+
1. Assert: _PreferredType_ is hint Number.
3485+
1. Let _hint_ be `"number"`.
34823486
1. Let _exoticToPrim_ be ? GetMethod(_input_, @@toPrimitive).
34833487
1. If _exoticToPrim_ is not *undefined*, then
34843488
1. Let _result_ be ? Call(_exoticToPrim_, _input_, &laquo; _hint_ &raquo;).
@@ -4436,7 +4440,8 @@ <h1>Abstract Relational Comparison</h1>
44364440
1. If the _LeftFirst_ flag is *true*, then
44374441
1. Let _px_ be ? ToPrimitive(_x_, hint Number).
44384442
1. Let _py_ be ? ToPrimitive(_y_, hint Number).
4439-
1. Else the order of evaluation needs to be reversed to preserve left to right evaluation,
4443+
1. Else,
4444+
1. NOTE: The order of evaluation needs to be reversed to preserve left to right evaluation.
44404445
1. Let _py_ be ? ToPrimitive(_y_, hint Number).
44414446
1. Let _px_ be ? ToPrimitive(_x_, hint Number).
44424447
1. If Type(_px_) is String and Type(_py_) is String, then
@@ -4681,7 +4686,8 @@ <h1>SetIntegrityLevel ( _O_, _level_ )</h1>
46814686
1. If _level_ is `"sealed"`, then
46824687
1. For each element _k_ of _keys_, do
46834688
1. Perform ? DefinePropertyOrThrow(_O_, _k_, PropertyDescriptor { [[Configurable]]: *false* }).
4684-
1. Else _level_ is `"frozen"`,
4689+
1. Else,
4690+
1. Assert: _level_ is `"frozen"`.
46854691
1. For each element _k_ of _keys_, do
46864692
1. Let _currentDesc_ be ? _O_.[[GetOwnProperty]](_k_).
46874693
1. If _currentDesc_ is not *undefined*, then
@@ -6597,7 +6603,8 @@ <h1>RunJobs ( )</h1>
65976603
1. In an implementation-dependent manner, obtain the ECMAScript source texts (see clause <emu-xref href="#sec-ecmascript-language-source-code"></emu-xref>) and any associated host-defined values for zero or more ECMAScript scripts and/or ECMAScript modules. For each such _sourceText_ and _hostDefined_, do
65986604
1. If _sourceText_ is the source code of a script, then
65996605
1. Perform EnqueueJob(`"ScriptJobs"`, ScriptEvaluationJob, &laquo; _sourceText_, _hostDefined_ &raquo;).
6600-
1. Else _sourceText_ is the source code of a module,
6606+
1. Else,
6607+
1. Assert: _sourceText_ is the source code of a module.
66016608
1. Perform EnqueueJob(`"ScriptJobs"`, TopLevelModuleEvaluationJob, &laquo; _sourceText_, _hostDefined_ &raquo;).
66026609
1. Repeat,
66036610
1. Suspend the running execution context and remove it from the execution context stack.
@@ -6885,7 +6892,8 @@ <h1>OrdinaryGetOwnProperty ( _O_, _P_ )</h1>
68856892
1. If _X_ is a data property, then
68866893
1. Set _D_.[[Value]] to the value of _X_'s [[Value]] attribute.
68876894
1. Set _D_.[[Writable]] to the value of _X_'s [[Writable]] attribute.
6888-
1. Else _X_ is an accessor property,
6895+
1. Else,
6896+
1. Assert: _X_ is an accessor property.
68896897
1. Set _D_.[[Get]] to the value of _X_'s [[Get]] attribute.
68906898
1. Set _D_.[[Set]] to the value of _X_'s [[Set]] attribute.
68916899
1. Set _D_.[[Enumerable]] to the value of _X_'s [[Enumerable]] attribute.
@@ -6933,7 +6941,8 @@ <h1>ValidateAndApplyPropertyDescriptor ( _O_, _P_, _extensible_, _Desc_, _curren
69336941
1. Assert: _extensible_ is *true*.
69346942
1. If IsGenericDescriptor(_Desc_) is *true* or IsDataDescriptor(_Desc_) is *true*, then
69356943
1. If _O_ is not *undefined*, create an own data property named _P_ of object _O_ whose [[Value]], [[Writable]], [[Enumerable]] and [[Configurable]] attribute values are described by _Desc_. If the value of an attribute field of _Desc_ is absent, the attribute of the newly created property is set to its default value.
6936-
1. Else _Desc_ must be an accessor Property Descriptor,
6944+
1. Else,
6945+
1. Assert: ! IsAccessorDescriptor(_Desc_) is *true*.
69376946
1. If _O_ is not *undefined*, create an own accessor property named _P_ of object _O_ whose [[Get]], [[Set]], [[Enumerable]] and [[Configurable]] attribute values are described by _Desc_. If the value of an attribute field of _Desc_ is absent, the attribute of the newly created property is set to its default value.
69386947
1. Return *true*.
69396948
1. If every field in _Desc_ is absent, return *true*.
@@ -6952,7 +6961,8 @@ <h1>ValidateAndApplyPropertyDescriptor ( _O_, _P_, _extensible_, _Desc_, _curren
69526961
1. If _Desc_.[[Writable]] is present and _Desc_.[[Writable]] is *true*, return *false*.
69536962
1. If _Desc_.[[Value]] is present and SameValue(_Desc_.[[Value]], _current_.[[Value]]) is *false*, return *false*.
69546963
1. Return *true*.
6955-
1. Else IsAccessorDescriptor(_current_) and IsAccessorDescriptor(_Desc_) are both *true*,
6964+
1. Else,
6965+
1. Assert: ! IsAccessorDescriptor(_current_) and ! IsAccessorDescriptor(_Desc_) are both *true*.
69566966
1. If _current_.[[Configurable]] is *false*, then
69576967
1. If _Desc_.[[Set]] is present and SameValue(_Desc_.[[Set]], _current_.[[Set]]) is *false*, return *false*.
69586968
1. If _Desc_.[[Get]] is present and SameValue(_Desc_.[[Get]], _current_.[[Get]]) is *false*, return *false*.
@@ -7053,7 +7063,8 @@ <h1>OrdinarySetWithOwnDescriptor ( _O_, _P_, _V_, _Receiver_, _ownDesc_ )</h1>
70537063
1. If _existingDescriptor_.[[Writable]] is *false*, return *false*.
70547064
1. Let _valueDesc_ be the PropertyDescriptor { [[Value]]: _V_ }.
70557065
1. Return ? _Receiver_.[[DefineOwnProperty]](_P_, _valueDesc_).
7056-
1. Else _Receiver_ does not currently have a property _P_,
7066+
1. Else,
7067+
1. Assert: _Receiver_ does not currently have a property _P_.
70577068
1. Return ? CreateDataProperty(_Receiver_, _P_, _V_).
70587069
1. Assert: IsAccessorDescriptor(_ownDesc_) is *true*.
70597070
1. Let _setter_ be _ownDesc_.[[Set]].
@@ -8144,7 +8155,8 @@ <h1>[[Get]] ( _P_, _Receiver_ )</h1>
81448155
1. Let _isMapped_ be ! HasOwnProperty(_map_, _P_).
81458156
1. If _isMapped_ is *false*, then
81468157
1. Return ? OrdinaryGet(_args_, _P_, _Receiver_).
8147-
1. Else _map_ contains a formal parameter mapping for _P_,
8158+
1. Else,
8159+
1. Assert: _map_ contains a formal parameter mapping for _P_.
81488160
1. Return Get(_map_, _P_).
81498161
</emu-alg>
81508162
</emu-clause>
@@ -12581,10 +12593,11 @@ <h1>Runtime Semantics: EvaluateCall ( _func_, _ref_, _arguments_, _tailPosition_
1258112593
1. If Type(_ref_) is Reference, then
1258212594
1. If IsPropertyReference(_ref_) is *true*, then
1258312595
1. Let _thisValue_ be GetThisValue(_ref_).
12584-
1. Else the base of _ref_ is an Environment Record,
12596+
1. Else,
12597+
1. Assert: the base of _ref_ is an Environment Record.
1258512598
1. Let _refEnv_ be GetBase(_ref_).
1258612599
1. Let _thisValue_ be _refEnv_.WithBaseObject().
12587-
1. Else Type(_ref_) is not Reference,
12600+
1. Else,
1258812601
1. Let _thisValue_ be *undefined*.
1258912602
1. Let _argList_ be ArgumentListEvaluation of _arguments_.
1259012603
1. ReturnIfAbrupt(_argList_).
@@ -12988,7 +13001,8 @@ <h1>Runtime Semantics: Evaluation</h1>
1298813001
1. Let _deleteStatus_ be ? _baseObj_.[[Delete]](GetReferencedName(_ref_)).
1298913002
1. If _deleteStatus_ is *false* and IsStrictReference(_ref_) is *true*, throw a *TypeError* exception.
1299013003
1. Return _deleteStatus_.
12991-
1. Else _ref_ is a Reference to an Environment Record binding,
13004+
1. Else,
13005+
1. Assert: _ref_ is a Reference to an Environment Record binding.
1299213006
1. Let _bindings_ be GetBase(_ref_).
1299313007
1. Return ? _bindings_.DeleteBinding(GetReferencedName(_ref_)).
1299413008
</emu-alg>
@@ -22408,9 +22422,10 @@ <h1>ParseModule ( _sourceText_, _realm_, _hostDefined_ )</h1>
2240822422
1. Else,
2240922423
1. Let _ie_ be the element of _importEntries_ whose [[LocalName]] is the same as _ee_.[[LocalName]].
2241022424
1. If _ie_.[[ImportName]] is `"*"`, then
22411-
1. Assert: This is a re-export of an imported module namespace object.
22425+
1. NOTE: This is a re-export of an imported module namespace object.
2241222426
1. Append _ee_ to _localExportEntries_.
22413-
1. Else this is a re-export of a single name,
22427+
1. Else,
22428+
1. NOTE: This is a re-export of a single name.
2241422429
1. Append the ExportEntry Record { [[ModuleRequest]]: _ie_.[[ModuleRequest]], [[ImportName]]: _ie_.[[ImportName]], [[LocalName]]: *null*, [[ExportName]]: _ee_.[[ExportName]] } to _indirectExportEntries_.
2241522430
1. Else if _ee_.[[ImportName]] is `"*"`, then
2241622431
1. Append _ee_ to _starExportEntries_.
@@ -23768,7 +23783,8 @@ <h1>Runtime Semantics: Decode ( _string_, _reservedSet_ )</h1>
2376823783
1. Let _S_ be the String value containing only the code unit _C_.
2376923784
1. Else,
2377023785
1. Let _S_ be the substring of _string_ from index _start_ to index _k_ inclusive.
23771-
1. Else the most significant bit in _B_ is 1,
23786+
1. Else,
23787+
1. Assert: the most significant bit in _B_ is 1.
2377223788
1. Let _n_ be the smallest nonnegative integer such that (_B_ &lt;&lt; _n_) &amp; 0x80 is equal to 0.
2377323789
1. If _n_ equals 1 or _n_ is greater than 4, throw a *URIError* exception.
2377423790
1. Let _Octets_ be a List of 8-bit integers of size _n_.
@@ -24727,7 +24743,8 @@ <h1>Runtime Semantics: CreateDynamicFunction ( _constructor_, _newTarget_, _kind
2472724743
1. Let _P_ be the empty String.
2472824744
1. If _argCount_ = 0, let _bodyText_ be the empty String.
2472924745
1. Else if _argCount_ = 1, let _bodyText_ be _args_[0].
24730-
1. Else _argCount_ &gt; 1,
24746+
1. Else,
24747+
1. Assert: _argCount_ &gt; 1.
2473124748
1. Let _firstArg_ be _args_[0].
2473224749
1. Set _P_ to ? ToString(_firstArg_).
2473324750
1. Let _k_ be 1.
@@ -25848,7 +25865,8 @@ <h1>Number.prototype.toPrecision ( _precision_ )</h1>
2584825865
1. Set _m_ to the string-concatenation of _a_, `"."`, and _b_.
2584925866
1. If _e_ &gt; 0, then
2585025867
1. Let _c_ be the code unit 0x002B (PLUS SIGN).
25851-
1. Else _e_ &lt; 0,
25868+
1. Else,
25869+
1. Assert: _e_ &lt; 0.
2585225870
1. Let _c_ be the code unit 0x002D (HYPHEN-MINUS).
2585325871
1. Set _e_ to -_e_.
2585425872
1. Let _d_ be the String value consisting of the digits of the decimal representation of _e_ (in order, with no leading zeroes).
@@ -28842,7 +28860,8 @@ <h1>String.prototype.split ( _separator_, _limit_ )</h1>
2884228860
1. Repeat, while _q_ &ne; _s_
2884328861
1. Let _e_ be SplitMatch(_S_, _q_, _R_).
2884428862
1. If _e_ is *false*, set _q_ to _q_ + 1.
28845-
1. Else _e_ is an integer index &le; _s_,
28863+
1. Else,
28864+
1. Assert: _e_ is an integer index &le; _s_.
2884628865
1. If _e_ = _p_, set _q_ to _q_ + 1.
2884728866
1. Else,
2884828867
1. Let _T_ be the String value equal to the substring of _S_ consisting of the code units at indices _p_ (inclusive) through _q_ (exclusive).
@@ -30995,7 +31014,8 @@ <h1>Runtime Semantics: RegExpBuiltinExec ( _R_, _S_ )</h1>
3099531014
1. Else if _fullUnicode_ is *true*, then
3099631015
1. Assert: _captureI_ is a List of code points.
3099731016
1. Let _capturedValue_ be the String value whose code units are the UTF16Encoding of the code points of _captureI_.
30998-
1. Else _fullUnicode_ is *false*,
31017+
1. Else,
31018+
1. Assert: _fullUnicode_ is *false*.
3099931019
1. Assert: _captureI_ is a List of code units.
3100031020
1. Let _capturedValue_ be the String value consisting of the code units of _captureI_.
3100131021
1. Perform ! CreateDataProperty(_A_, ! ToString(_i_), _capturedValue_).
@@ -31100,7 +31120,8 @@ <h1>RegExp.prototype [ @@match ] ( _string_ )</h1>
3110031120
1. Let _global_ be ToBoolean(? Get(_rx_, `"global"`)).
3110131121
1. If _global_ is *false*, then
3110231122
1. Return ? RegExpExec(_rx_, _S_).
31103-
1. Else _global_ is *true*,
31123+
1. Else,
31124+
1. Assert: _global_ is *true*.
3110431125
1. Let _fullUnicode_ be ToBoolean(? Get(_rx_, `"unicode"`)).
3110531126
1. Perform ? Set(_rx_, `"lastIndex"`, 0, *true*).
3110631127
1. Let _A_ be ! ArrayCreate(0).
@@ -31755,7 +31776,8 @@ <h1>Array.prototype.concat ( ..._arguments_ )</h1>
3175531776
1. Perform ? CreateDataPropertyOrThrow(_A_, ! ToString(_n_), _subElement_).
3175631777
1. Set _n_ to _n_ + 1.
3175731778
1. Set _k_ to _k_ + 1.
31758-
1. Else _E_ is added as a single item rather than spread,
31779+
1. Else,
31780+
1. NOTE: _E_ is added as a single item rather than spread.
3175931781
1. If _n_ &ge; 2<sup>53</sup> - 1, throw a *TypeError* exception.
3176031782
1. Perform ? CreateDataPropertyOrThrow(_A_, ! ToString(_n_), _E_).
3176131783
1. Set _n_ to _n_ + 1.
@@ -31817,7 +31839,8 @@ <h1>Array.prototype.copyWithin ( _target_, _start_ [ , _end_ ] )</h1>
3181731839
1. If _fromPresent_ is *true*, then
3181831840
1. Let _fromVal_ be ? Get(_O_, _fromKey_).
3181931841
1. Perform ? Set(_O_, _toKey_, _fromVal_, *true*).
31820-
1. Else _fromPresent_ is *false*,
31842+
1. Else,
31843+
1. Assert: _fromPresent_ is *false*.
3182131844
1. Perform ? DeletePropertyOrThrow(_O_, _toKey_).
3182231845
1. Set _from_ to _from_ + _direction_.
3182331846
1. Set _to_ to _to_ + _direction_.
@@ -32257,7 +32280,8 @@ <h1>Array.prototype.pop ( )</h1>
3225732280
1. If _len_ is zero, then
3225832281
1. Perform ? Set(_O_, `"length"`, 0, *true*).
3225932282
1. Return *undefined*.
32260-
1. Else _len_ &gt; 0,
32283+
1. Else,
32284+
1. Assert: _len_ &gt; 0.
3226132285
1. Let _newLen_ be _len_ - 1.
3226232286
1. Let _index_ be ! ToString(_newLen_).
3226332287
1. Let _element_ be ? Get(_O_, _index_).
@@ -32407,7 +32431,8 @@ <h1>Array.prototype.reverse ( )</h1>
3240732431
1. Else if _lowerExists_ is *true* and _upperExists_ is *false*, then
3240832432
1. Perform ? DeletePropertyOrThrow(_O_, _lowerP_).
3240932433
1. Perform ? Set(_O_, _upperP_, _lowerValue_, *true*).
32410-
1. Else both _lowerExists_ and _upperExists_ are *false*,
32434+
1. Else,
32435+
1. Assert: _lowerExists_ and _upperExists_ are both *false*.
3241132436
1. No action is required.
3241232437
1. Set _lower_ to _lower_ + 1.
3241332438
1. Return _O_.
@@ -32438,7 +32463,8 @@ <h1>Array.prototype.shift ( )</h1>
3243832463
1. If _fromPresent_ is *true*, then
3243932464
1. Let _fromVal_ be ? Get(_O_, _from_).
3244032465
1. Perform ? Set(_O_, _to_, _fromVal_, *true*).
32441-
1. Else _fromPresent_ is *false*,
32466+
1. Else,
32467+
1. Assert: _fromPresent_ is *false*.
3244232468
1. Perform ? DeletePropertyOrThrow(_O_, _to_).
3244332469
1. Set _k_ to _k_ + 1.
3244432470
1. Perform ? DeletePropertyOrThrow(_O_, ! ToString(_len_ - 1)).
@@ -32692,7 +32718,8 @@ <h1>Array.prototype.splice ( _start_, _deleteCount_, ..._items_ )</h1>
3269232718
1. If _fromPresent_ is *true*, then
3269332719
1. Let _fromValue_ be ? Get(_O_, _from_).
3269432720
1. Perform ? Set(_O_, _to_, _fromValue_, *true*).
32695-
1. Else _fromPresent_ is *false*,
32721+
1. Else,
32722+
1. Assert: _fromPresent_ is *false*.
3269632723
1. Perform ? DeletePropertyOrThrow(_O_, _to_).
3269732724
1. Set _k_ to _k_ + 1.
3269832725
1. Set _k_ to _len_.
@@ -32708,7 +32735,8 @@ <h1>Array.prototype.splice ( _start_, _deleteCount_, ..._items_ )</h1>
3270832735
1. If _fromPresent_ is *true*, then
3270932736
1. Let _fromValue_ be ? Get(_O_, _from_).
3271032737
1. Perform ? Set(_O_, _to_, _fromValue_, *true*).
32711-
1. Else _fromPresent_ is *false*,
32738+
1. Else,
32739+
1. Assert: _fromPresent_ is *false*.
3271232740
1. Perform ? DeletePropertyOrThrow(_O_, _to_).
3271332741
1. Set _k_ to _k_ - 1.
3271432742
1. Set _k_ to _actualStart_.
@@ -32793,7 +32821,8 @@ <h1>Array.prototype.unshift ( ..._items_ )</h1>
3279332821
1. If _fromPresent_ is *true*, then
3279432822
1. Let _fromValue_ be ? Get(_O_, _from_).
3279532823
1. Perform ? Set(_O_, _to_, _fromValue_, *true*).
32796-
1. Else _fromPresent_ is *false*,
32824+
1. Else,
32825+
1. Assert: _fromPresent_ is *false*.
3279732826
1. Perform ? DeletePropertyOrThrow(_O_, _to_).
3279832827
1. Set _k_ to _k_ - 1.
3279932828
1. Let _j_ be 0.
@@ -40505,7 +40534,8 @@ <h1>escape ( _string_ )</h1>
4050540534
1. Let _S_ be the string-concatenation of:
4050640535
* `"%u"`
4050740536
* the String representation of _n_, formatted as a four-digit uppercase hexadecimal number, padded to the left with zeroes if necessary
40508-
1. Else _char_ &lt; 256,
40537+
1. Else,
40538+
1. Assert: _char_ &lt; 256.
4050940539
1. Let _n_ be the numeric value of _char_.
4051040540
1. Let _S_ be the string-concatenation of:
4051140541
* `"%"`

0 commit comments

Comments
 (0)