Skip to content

Commit 82bccd6

Browse files
Editorial: unify various forms of if-otherwise in single-line conditionals
1 parent a8677a8 commit 82bccd6

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

spec.html

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6139,11 +6139,11 @@ <h1>
61396139
1. If _x_ is a BigInt, then
61406140
1. Return BigInt::equal(_x_, _y_).
61416141
1. If _x_ is a String, then
6142-
1. If _x_ and _y_ have the same length and the same code units in the same positions, return *true*; otherwise, return *false*.
6142+
1. If _x_ and _y_ have the same length and the same code units in the same positions, return *true*; otherwise return *false*.
61436143
1. If _x_ is a Boolean, then
6144-
1. If _x_ and _y_ are both *true* or both *false*, return *true*; otherwise, return *false*.
6144+
1. If _x_ and _y_ are both *true* or both *false*, return *true*; otherwise return *false*.
61456145
1. NOTE: All other ECMAScript language values are compared by identity.
6146-
1. If _x_ is _y_, return *true*; otherwise, return *false*.
6146+
1. If _x_ is _y_, return *true*; otherwise return *false*.
61476147
</emu-alg>
61486148
<emu-note>
61496149
For expository purposes, some cases are handled separately within this algorithm even if it is unnecessary to do so.
@@ -10918,7 +10918,7 @@ <h1>HasThisBinding ( ): a Boolean</h1>
1091810918
<dd>a Function Environment Record _envRec_</dd>
1091910919
</dl>
1092010920
<emu-alg>
10921-
1. If _envRec_.[[ThisBindingStatus]] is ~lexical~, return *false*; otherwise, return *true*.
10921+
1. If _envRec_.[[ThisBindingStatus]] is ~lexical~, return *false*; otherwise return *true*.
1092210922
</emu-alg>
1092310923
</emu-clause>
1092410924

@@ -10930,7 +10930,7 @@ <h1>HasSuperBinding ( ): a Boolean</h1>
1093010930
</dl>
1093110931
<emu-alg>
1093210932
1. If _envRec_.[[ThisBindingStatus]] is ~lexical~, return *false*.
10933-
1. If _envRec_.[[FunctionObject]].[[HomeObject]] is *undefined*, return *false*; otherwise, return *true*.
10933+
1. If _envRec_.[[FunctionObject]].[[HomeObject]] is *undefined*, return *false*; otherwise return *true*.
1093410934
</emu-alg>
1093510935
</emu-clause>
1093610936

@@ -14060,7 +14060,7 @@ <h1>
1406014060
1. Set the ScriptOrModule of _calleeContext_ to *null*.
1406114061
1. Perform any necessary implementation-defined initialization of _calleeContext_.
1406214062
1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context.
14063-
1. [id="step-call-builtin-function-result"] Let _result_ be the Completion Record that is <emu-meta effects="user-code">the result of evaluating</emu-meta> _F_ in a manner that conforms to the specification of _F_. If _thisArgument_ is ~uninitialized~, the *this* value is uninitialized; otherwise, _thisArgument_ provides the *this* value. _argumentsList_ provides the named parameters. _newTarget_ provides the NewTarget value.
14063+
1. [id="step-call-builtin-function-result"] Let _result_ be the Completion Record that is <emu-meta effects="user-code">the result of evaluating</emu-meta> _F_ in a manner that conforms to the specification of _F_. If _thisArgument_ is ~uninitialized~, the *this* value is uninitialized; otherwise _thisArgument_ provides the *this* value. _argumentsList_ provides the named parameters. _newTarget_ provides the NewTarget value.
1406414064
1. NOTE: If _F_ is defined in this document, “the specification of _F_” is the behaviour specified for it via algorithm steps or other means.
1406514065
1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context.
1406614066
1. Return ? _result_.
@@ -22132,15 +22132,15 @@ <h1>
2213222132
1. If the first |Expression| is present, then
2213322133
1. Let _exprRef_ be ? Evaluation of the first |Expression|.
2213422134
1. Perform ? GetValue(_exprRef_).
22135-
1. If the second |Expression| is present, let _test_ be the second |Expression|; otherwise, let _test_ be ~empty~.
22136-
1. If the third |Expression| is present, let _increment_ be the third |Expression|; otherwise, let _increment_ be ~empty~.
22135+
1. If the second |Expression| is present, let _test_ be the second |Expression|; otherwise let _test_ be ~empty~.
22136+
1. If the third |Expression| is present, let _increment_ be the third |Expression|; otherwise let _increment_ be ~empty~.
2213722137
1. Return ? ForBodyEvaluation(_test_, _increment_, |Statement|, « », _labelSet_).
2213822138
</emu-alg>
2213922139
<emu-grammar>ForStatement : `for` `(` `var` VariableDeclarationList `;` Expression? `;` Expression? `)` Statement</emu-grammar>
2214022140
<emu-alg>
2214122141
1. Perform ? Evaluation of |VariableDeclarationList|.
22142-
1. If the first |Expression| is present, let _test_ be the first |Expression|; otherwise, let _test_ be ~empty~.
22143-
1. If the second |Expression| is present, let _increment_ be the second |Expression|; otherwise, let _increment_ be ~empty~.
22142+
1. If the first |Expression| is present, let _test_ be the first |Expression|; otherwise let _test_ be ~empty~.
22143+
1. If the second |Expression| is present, let _increment_ be the second |Expression|; otherwise let _increment_ be ~empty~.
2214422144
1. Return ? ForBodyEvaluation(_test_, _increment_, |Statement|, « », _labelSet_).
2214522145
</emu-alg>
2214622146
<emu-grammar>ForStatement : `for` `(` LexicalDeclaration Expression? `;` Expression? `)` Statement</emu-grammar>
@@ -22160,8 +22160,8 @@ <h1>
2216022160
1. Set the running execution context's LexicalEnvironment to _oldEnv_.
2216122161
1. Return ? _forDcl_.
2216222162
1. If _isConst_ is *false*, let _perIterationLets_ be _boundNames_; otherwise let _perIterationLets_ be a new empty List.
22163-
1. If the first |Expression| is present, let _test_ be the first |Expression|; otherwise, let _test_ be ~empty~.
22164-
1. If the second |Expression| is present, let _increment_ be the second |Expression|; otherwise, let _increment_ be ~empty~.
22163+
1. If the first |Expression| is present, let _test_ be the first |Expression|; otherwise let _test_ be ~empty~.
22164+
1. If the second |Expression| is present, let _increment_ be the second |Expression|; otherwise let _increment_ be ~empty~.
2216522165
1. Let _bodyResult_ be Completion(ForBodyEvaluation(_test_, _increment_, |Statement|, _perIterationLets_, _labelSet_)).
2216622166
1. Set the running execution context's LexicalEnvironment to _oldEnv_.
2216722167
1. Return ? _bodyResult_.
@@ -23720,7 +23720,7 @@ <h1>Static Semantics: FunctionBodyContainsUseStrict ( ): a Boolean</h1>
2372023720
</dl>
2372123721
<emu-grammar>FunctionBody : FunctionStatementList</emu-grammar>
2372223722
<emu-alg>
23723-
1. If the Directive Prologue of |FunctionBody| contains a Use Strict Directive, return *true*; otherwise, return *false*.
23723+
1. If the Directive Prologue of |FunctionBody| contains a Use Strict Directive, return *true*; otherwise return *false*.
2372423724
</emu-alg>
2372523725
</emu-clause>
2372623726

@@ -26122,7 +26122,7 @@ <h1>Static Semantics: ScriptIsStrict ( ): a Boolean</h1>
2612226122
</dl>
2612326123
<emu-grammar>Script : ScriptBody?</emu-grammar>
2612426124
<emu-alg>
26125-
1. If |ScriptBody| is present and the Directive Prologue of |ScriptBody| contains a Use Strict Directive, return *true*; otherwise, return *false*.
26125+
1. If |ScriptBody| is present and the Directive Prologue of |ScriptBody| contains a Use Strict Directive, return *true*; otherwise return *false*.
2612626126
</emu-alg>
2612726127
</emu-clause>
2612826128

@@ -30080,7 +30080,7 @@ <h1>parseInt ( _string_, _radix_ )</h1>
3008030080
1. If the length of _S_ is at least 2 and the first two code units of _S_ are either *"0x"* or *"0X"*, then
3008130081
1. Set _S_ to the substring of _S_ from index 2.
3008230082
1. Set _R_ to 16.
30083-
1. If _S_ contains a code unit that is not a radix-_R_ digit, let _end_ be the index within _S_ of the first such code unit; otherwise, let _end_ be the length of _S_.
30083+
1. If _S_ contains a code unit that is not a radix-_R_ digit, let _end_ be the index within _S_ of the first such code unit; otherwise let _end_ be the length of _S_.
3008430084
1. Let _Z_ be the substring of _S_ from 0 to _end_.
3008530085
1. If _Z_ is empty, return *NaN*.
3008630086
1. Let _mathInt_ be the integer value that is represented by _Z_ in radix-_R_ notation, using the letters <b>A</b> through <b>Z</b> and <b>a</b> through <b>z</b> for digits with values 10 through 35. (However, if _R_ = 10 and _Z_ contains more than 20 significant digits, every significant digit after the 20th may be replaced by a 0 digit, at the option of the implementation; and if _R_ is not one of 2, 4, 8, 10, 16, or 32, then _mathInt_ may be an implementation-approximated integer representing the integer value denoted by _Z_ in radix-_R_ notation.)
@@ -32548,7 +32548,7 @@ <h1>BigInt.asIntN ( _bits_, _bigint_ )</h1>
3254832548
1. Set _bits_ to ? ToIndex(_bits_).
3254932549
1. Set _bigint_ to ? ToBigInt(_bigint_).
3255032550
1. Let _mod_ be ℝ(_bigint_) modulo 2<sup>_bits_</sup>.
32551-
1. If _mod_ ≥ 2<sup>_bits_ - 1</sup>, return ℤ(_mod_ - 2<sup>_bits_</sup>); otherwise, return ℤ(_mod_).
32551+
1. If _mod_ ≥ 2<sup>_bits_ - 1</sup>, return ℤ(_mod_ - 2<sup>_bits_</sup>); otherwise return ℤ(_mod_).
3255232552
</emu-alg>
3255332553
</emu-clause>
3255432554

@@ -34603,9 +34603,9 @@ <h1>Date.prototype.setFullYear ( _year_ [ , _month_ [ , _date_ ] ] )</h1>
3460334603
1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]).
3460434604
1. Let _t_ be _dateObject_.[[DateValue]].
3460534605
1. Let _y_ be ? ToNumber(_year_).
34606-
1. If _t_ is *NaN*, set _t_ to *+0*<sub>𝔽</sub>; otherwise, set _t_ to LocalTime(_t_).
34607-
1. If _month_ is not present, let _m_ be MonthFromTime(_t_); otherwise, let _m_ be ? ToNumber(_month_).
34608-
1. If _date_ is not present, let _dt_ be DateFromTime(_t_); otherwise, let _dt_ be ? ToNumber(_date_).
34606+
1. If _t_ is *NaN*, set _t_ to *+0*<sub>𝔽</sub>; otherwise set _t_ to LocalTime(_t_).
34607+
1. If _month_ is not present, let _m_ be MonthFromTime(_t_); otherwise let _m_ be ? ToNumber(_month_).
34608+
1. If _date_ is not present, let _dt_ be DateFromTime(_t_); otherwise let _dt_ be ? ToNumber(_date_).
3460934609
1. Let _newDate_ be MakeDate(MakeDay(_y_, _m_, _dt_), TimeWithinDay(_t_)).
3461034610
1. Let _u_ be TimeClip(UTC(_newDate_)).
3461134611
1. Set _dateObject_.[[DateValue]] to _u_.
@@ -34770,8 +34770,8 @@ <h1>Date.prototype.setUTCFullYear ( _year_ [ , _month_ [ , _date_ ] ] )</h1>
3477034770
1. Let _t_ be _dateObject_.[[DateValue]].
3477134771
1. If _t_ is *NaN*, set _t_ to *+0*<sub>𝔽</sub>.
3477234772
1. Let _y_ be ? ToNumber(_year_).
34773-
1. If _month_ is not present, let _m_ be MonthFromTime(_t_); otherwise, let _m_ be ? ToNumber(_month_).
34774-
1. If _date_ is not present, let _dt_ be DateFromTime(_t_); otherwise, let _dt_ be ? ToNumber(_date_).
34773+
1. If _month_ is not present, let _m_ be MonthFromTime(_t_); otherwise let _m_ be ? ToNumber(_month_).
34774+
1. If _date_ is not present, let _dt_ be DateFromTime(_t_); otherwise let _dt_ be ? ToNumber(_date_).
3477534775
1. Let _newDate_ be MakeDate(MakeDay(_y_, _m_, _dt_), TimeWithinDay(_t_)).
3477634776
1. Let _v_ be TimeClip(_newDate_).
3477734777
1. Set _dateObject_.[[DateValue]] to _v_.
@@ -35004,7 +35004,7 @@ <h1>
3500435004
1. Let _month_ be the Name of the entry in <emu-xref href="#sec-todatestring-month-names"></emu-xref> with the Number MonthFromTime(_tv_).
3500535005
1. Let _day_ be ToZeroPaddedDecimalString(ℝ(DateFromTime(_tv_)), 2).
3500635006
1. Let _yv_ be YearFromTime(_tv_).
35007-
1. If _yv_ is *+0*<sub>𝔽</sub> or _yv_ > *+0*<sub>𝔽</sub>, let _yearSign_ be the empty String; otherwise, let _yearSign_ be *"-"*.
35007+
1. If _yv_ is *+0*<sub>𝔽</sub> or _yv_ > *+0*<sub>𝔽</sub>, let _yearSign_ be the empty String; otherwise let _yearSign_ be *"-"*.
3500835008
1. Let _paddedYear_ be ToZeroPaddedDecimalString(abs(ℝ(_yv_)), 4).
3500935009
1. Return the string-concatenation of _weekday_, the code unit 0x0020 (SPACE), _month_, the code unit 0x0020 (SPACE), _day_, the code unit 0x0020 (SPACE), _yearSign_, and _paddedYear_.
3501035010
</emu-alg>
@@ -35260,7 +35260,7 @@ <h1>Date.prototype.toUTCString ( )</h1>
3526035260
1. Let _month_ be the Name of the entry in <emu-xref href="#sec-todatestring-month-names"></emu-xref> with the Number MonthFromTime(_tv_).
3526135261
1. Let _day_ be ToZeroPaddedDecimalString(ℝ(DateFromTime(_tv_)), 2).
3526235262
1. Let _yv_ be YearFromTime(_tv_).
35263-
1. If _yv_ is *+0*<sub>𝔽</sub> or _yv_ > *+0*<sub>𝔽</sub>, let _yearSign_ be the empty String; otherwise, let _yearSign_ be *"-"*.
35263+
1. If _yv_ is *+0*<sub>𝔽</sub> or _yv_ > *+0*<sub>𝔽</sub>, let _yearSign_ be the empty String; otherwise let _yearSign_ be *"-"*.
3526435264
1. Let _paddedYear_ be ToZeroPaddedDecimalString(abs(ℝ(_yv_)), 4).
3526535265
1. Return the string-concatenation of _weekday_, *","*, the code unit 0x0020 (SPACE), _day_, the code unit 0x0020 (SPACE), _month_, the code unit 0x0020 (SPACE), _yearSign_, _paddedYear_, the code unit 0x0020 (SPACE), and TimeString(_tv_).
3526635266
</emu-alg>
@@ -35626,7 +35626,7 @@ <h1>String.prototype.lastIndexOf ( _searchString_ [ , _position_ ] )</h1>
3562635626
1. Let _searchStr_ be ? ToString(_searchString_).
3562735627
1. Let _numPos_ be ? ToNumber(_position_).
3562835628
1. Assert: If _position_ is *undefined*, then _numPos_ is *NaN*.
35629-
1. If _numPos_ is *NaN*, let _pos_ be +∞; otherwise, let _pos_ be ! ToIntegerOrInfinity(_numPos_).
35629+
1. If _numPos_ is *NaN*, let _pos_ be +∞; otherwise let _pos_ be ! ToIntegerOrInfinity(_numPos_).
3563035630
1. Let _len_ be the length of _S_.
3563135631
1. Let _searchLen_ be the length of _searchStr_.
3563235632
1. Let _start_ be the result of clamping _pos_ between 0 and _len_ - _searchLen_.
@@ -42265,7 +42265,7 @@ <h1>
4226542265
1. If _targetOffset_ = +∞, throw a *RangeError* exception.
4226642266
1. If _srcLength_ + _targetOffset_ > _targetLength_, throw a *RangeError* exception.
4226742267
1. If _target_.[[ContentType]] is not _source_.[[ContentType]], throw a *TypeError* exception.
42268-
1. If IsSharedArrayBuffer(_srcBuffer_) is *true*, IsSharedArrayBuffer(_targetBuffer_) is *true*, and _srcBuffer_.[[ArrayBufferData]] is _targetBuffer_.[[ArrayBufferData]], let _sameSharedArrayBuffer_ be *true*; otherwise, let _sameSharedArrayBuffer_ be *false*.
42268+
1. If IsSharedArrayBuffer(_srcBuffer_) is *true*, IsSharedArrayBuffer(_targetBuffer_) is *true*, and _srcBuffer_.[[ArrayBufferData]] is _targetBuffer_.[[ArrayBufferData]], let _sameSharedArrayBuffer_ be *true*; otherwise let _sameSharedArrayBuffer_ be *false*.
4226942269
1. If SameValue(_srcBuffer_, _targetBuffer_) is *true* or _sameSharedArrayBuffer_ is *true*, then
4227042270
1. Let _srcByteLength_ be TypedArrayByteLength(_srcRecord_).
4227142271
1. Set _srcBuffer_ to ? CloneArrayBuffer(_srcBuffer_, _srcByteOffset_, _srcByteLength_).
@@ -52597,7 +52597,7 @@ <h1>Date.prototype.setYear ( _year_ )</h1>
5259752597
1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]).
5259852598
1. Let _t_ be _dateObject_.[[DateValue]].
5259952599
1. Let _y_ be ? ToNumber(_year_).
52600-
1. If _t_ is *NaN*, set _t_ to *+0*<sub>𝔽</sub>; otherwise, set _t_ to LocalTime(_t_).
52600+
1. If _t_ is *NaN*, set _t_ to *+0*<sub>𝔽</sub>; otherwise set _t_ to LocalTime(_t_).
5260152601
1. Let _yyyy_ be MakeFullYear(_y_).
5260252602
1. Let _d_ be MakeDay(_yyyy_, MonthFromTime(_t_), DateFromTime(_t_)).
5260352603
1. Let _date_ be MakeDate(_d_, TimeWithinDay(_t_)).

0 commit comments

Comments
 (0)