Skip to content

Commit

Permalink
[spec] add header types, correct ecmarkup errors (#348)
Browse files Browse the repository at this point in the history
Co-authored-by: Ashley Claymore <acutmore@users.noreply.github.com>
  • Loading branch information
ljharb and acutmore authored Aug 22, 2022
1 parent 4ea1992 commit 54d21ee
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 78 deletions.
58 changes: 29 additions & 29 deletions spec/abstract-operations.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>
ToPrimitive (
_input_: an ECMAScript language value,
optional _preferredType_: ~string~ or ~number~,
)
): either a normal completion containing an ECMAScript language value, or a throw completion
</h1>
<dl class="header">
<dt>description</dt>
Expand Down Expand Up @@ -45,7 +45,7 @@ <h1>
<h1>
ToBoolean (
_argument_: unknown,
)
): a Boolean
</h1>
<dl class="header">
<dt>description</dt>
Expand Down Expand Up @@ -707,8 +707,8 @@ <h1>
1. Return Number::sameValue(_x_, _y_).
1. If Type(_x_) is BigInt, then
1. Return BigInt::sameValue(_x_, _y_).
1. <ins>If Type(_x_) is Record, return ! RecordSameValue(_x_, _y_).</ins>
1. <ins>If Type(_x_) is Tuple, return ! TupleSameValue(_x_, _y_).</ins>
1. <ins>If Type(_x_) is Record, return RecordSameValue(_x_, _y_).</ins>
1. <ins>If Type(_x_) is Tuple, return TupleSameValue(_x_, _y_).</ins>
1. <del>Return SameValueNonNumeric(_x_, _y_).</del>
1. <ins>Return SameValueNonGeneric(_x_, _y_).</ins>
</emu-alg>
Expand All @@ -722,7 +722,7 @@ <h1>
SameValueZero (
_x_: an ECMAScript language value,
_y_: an ECMAScript language value,
)
): a Boolean
</h1>
<dl class="header">
<dt>description</dt>
Expand All @@ -734,8 +734,8 @@ <h1>
1. Return Number::sameValueZero(_x_, _y_).
1. If Type(_x_) is BigInt, then
1. Return BigInt::sameValueZero(_x_, _y_).
1. <ins>If Type(_x_) is Record, return ! RecordSameValueZero(_x_, _y_).</ins>
1. <ins>If Type(_x_) is Tuple, return ! TupleSameValueZero(_x_, _y_).</ins>
1. <ins>If Type(_x_) is Record, return RecordSameValueZero(_x_, _y_).</ins>
1. <ins>If Type(_x_) is Tuple, return TupleSameValueZero(_x_, _y_).</ins>
1. <del>Return SameValueNonNumeric(_x_, _y_).</del>
1. <ins>Return SameValueNonGeneric(_x_, _y_).</ins>
</emu-alg>
Expand All @@ -750,7 +750,7 @@ <h1>
SameValueNonNumeric (
_x_: an ECMAScript language value, but not a Number or a BigInt,
_y_: an ECMAScript language value, but not a Number or a BigInt,
)
): a Boolean
</del>
</h1>
<dl class="header">
Expand All @@ -763,7 +763,7 @@ <h1>
SameValueNonGeneric (
_x_: an ECMAScript language value, but not one of Number, BigInt, Record or Tuple,
_y_: an ECMAScript language value, but not one of Number, BigInt, Record or Tuple,
)
): a Boolean
</ins>
</h1>
<dl class="header">
Expand All @@ -790,7 +790,7 @@ <h1>
IsLooselyEqual (
_x_: an ECMAScript language value,
_y_: an ECMAScript language value,
)
): either a normal completion containing a Boolean or a throw completion
</h1>
<dl class="header">
<dt>description</dt>
Expand All @@ -802,17 +802,17 @@ <h1>
1. If _x_ is *null* and _y_ is *undefined*, return *true*.
1. If _x_ is *undefined* and _y_ is *null*, return *true*.
1. [id="step-abstract-equality-comparison-web-compat-insertion-point"] NOTE: This step is replaced in section <emu-xref href="#sec-IsHTMLDDA-internal-slot-aec"></emu-xref>.
1. If Type(_x_) is Number and Type(_y_) is String, return IsLooselyEqual(_x_, ! ToNumber(_y_)).
1. If Type(_x_) is String and Type(_y_) is Number, return IsLooselyEqual(! ToNumber(_x_), _y_).
1. If Type(_x_) is Number and Type(_y_) is String, return ? IsLooselyEqual(_x_, ! ToNumber(_y_)).
1. If Type(_x_) is String and Type(_y_) is Number, return ? IsLooselyEqual(! ToNumber(_x_), _y_).
1. If Type(_x_) is BigInt and Type(_y_) is String, then
1. Let _n_ be StringToBigInt(_y_).
1. If _n_ is *NaN*, return *false*.
1. Return IsLooselyEqual(_x_, _n_).
1. If Type(_x_) is String and Type(_y_) is BigInt, return IsLooselyEqual(_y_, _x_).
1. If Type(_x_) is Boolean, return IsLooselyEqual(! ToNumber(_x_), _y_).
1. If Type(_y_) is Boolean, return IsLooselyEqual(_x_, ! ToNumber(_y_)).
1. If Type(_x_) is either String, Number, BigInt<ins>, Record, Tuple</ins>, or Symbol and Type(_y_) is Object, return IsLooselyEqual(_x_, ? ToPrimitive(_y_)).
1. If Type(_x_) is Object and Type(_y_) is either String, Number, BigInt<ins>, Record, Tuple</ins>, or Symbol, return IsLooselyEqual(? ToPrimitive(_x_), _y_).
1. Return ? IsLooselyEqual(_x_, _n_).
1. If Type(_x_) is String and Type(_y_) is BigInt, return ? IsLooselyEqual(_y_, _x_).
1. If Type(_x_) is Boolean, return ? IsLooselyEqual(! ToNumber(_x_), _y_).
1. If Type(_y_) is Boolean, return ? IsLooselyEqual(_x_, ! ToNumber(_y_)).
1. If Type(_x_) is either String, Number, BigInt<ins>, Record, Tuple</ins>, or Symbol and Type(_y_) is Object, return ? IsLooselyEqual(_x_, ? ToPrimitive(_y_)).
1. If Type(_x_) is Object and Type(_y_) is either String, Number, BigInt<ins>, Record, Tuple</ins>, or Symbol, return ? IsLooselyEqual(? ToPrimitive(_x_), _y_).
1. If Type(_x_) is BigInt and Type(_y_) is Number, or if Type(_x_) is Number and Type(_y_) is BigInt, then
1. If _x_ or _y_ are any of *NaN*, *+&infin;*<sub>𝔽</sub>, or *-&infin;*<sub>𝔽</sub>, return *false*.
1. If ℝ(_x_) = ℝ(_y_), return *true*; otherwise return *false*.
Expand All @@ -825,7 +825,7 @@ <h1>
IsStrictlyEqual (
_x_: an ECMAScript language value,
_y_: an ECMAScript language value,
)
): a Boolean
</h1>
<dl class="header">
<dt>description</dt>
Expand All @@ -838,9 +838,9 @@ <h1>
1. If Type(_x_) is BigInt, then
1. Return BigInt::equal(_x_, _y_).
1. <ins>If Type(_x_) is Record, then</ins>
1. <ins>Return ! RecordSameValueZero(_x_, _y_).</ins>
1. <ins>Return RecordSameValueZero(_x_, _y_).</ins>
1. <ins>If Type(_x_) is Tuple, then</ins>
1. <ins>Return ! TupleSameValueZero(_x_, _y_).</ins>
1. <ins>Return TupleSameValueZero(_x_, _y_).</ins>
1. <del>Return SameValueNonNumeric(_x_, _y_).</del>
1. <ins>Return SameValueNonGeneric(_x_, _y_).</ins>
</emu-alg>
Expand All @@ -858,7 +858,7 @@ <h1>
<ins>
CreateRecord (
_entries_: a List of Records with fields [[Key]] (a String) and [[Value]] (an ECMAScript language value),
)
): a new Record value
</ins>
</h1>
<dl class="header">
Expand All @@ -876,7 +876,7 @@ <h1>
<ins>
DeduplicateRecordEntries (
_entries_: a List of Records with fields [[Key]] (a String) and [[Value]] (an ECMAScript language value),
)
): a List of Records with fields [[Key]] (a String) and [[Value]] (an ECMAScript language value)
</ins>
</h1>
<dl class="header">
Expand All @@ -901,7 +901,7 @@ <h1>
_entries_: a List of Records with fields [[Key]] (a String) and [[Value]] (an ECMAScript language value),
_propName_: a property key,
_value_: an ECMAScript language value
)
): either a normal completion containing a List of Records with fields [[Key]] (a String) and [[Value]] (an ECMAScript language value), or a throw completion
</ins>
</h1>
<dl class="header">
Expand All @@ -926,7 +926,7 @@ <h1>
AddValueToTupleSequenceList (
_sequence_: a List of ECMAScript language values,
_value_: an ECMAScript language value,
)
): either a normal completion containing a List of ECMAScript language values, or a throw completion
</ins>
</h1>
<dl class="header">
Expand All @@ -946,7 +946,7 @@ <h1>
<ins>
IsTuple (
_O_: an ECMAScript language value,
)
): a Boolean
</ins>
</h1>
<dl class="header">
Expand All @@ -961,15 +961,15 @@ <h1>
<h1>
IsConcatSpreadable (
_O_: unknown,
)
): either a normal completion containing a Boolean or a throw completion
</h1>
<dl class="header">
</dl>
<emu-alg>
1. If Type(_O_) is not Object or Tuple, return *false*.
1. Let _spreadable_ be ? Get<ins>V</ins>(_O_, @@isConcatSpreadable).
1. If _spreadable_ is not *undefined*, return ! ToBoolean(_spreadable_).
1. <ins>If ! IsTuple(_O_), return *true*.</ins>
1. If _spreadable_ is not *undefined*, return ToBoolean(_spreadable_).
1. <ins>If IsTuple(_O_), return *true*.</ins>
1. Return ? IsArray(_O_).
</emu-alg>
</emu-clause>
Expand Down
38 changes: 19 additions & 19 deletions spec/data-types-and-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1>
<ins>
RecordToString (
_argument_: a Record,
)
): a String
</ins>
</h1>
<dl class="header">
Expand All @@ -33,7 +33,7 @@ <h1>
_x_: a Record,
_y_: a Record,
_elementEqual_: an Abstract Closure,
)
): a Boolean
</ins>
</h1>
<dl class="header"></dl>
Expand All @@ -47,8 +47,8 @@ <h1>
1. Repeat, while _k_ &lt; _xLen_,
1. Let _xField_ be _xList_[_k_].
1. Let _yField_ be _yList_[_k_].
1. If ! SameValueNonGeneric(_xField_.[[Key]], _yField_.[[Key]]) is *false*, Return *false*.
1. If ! _elementEqual_(_xField_.[[Value]], _yField_.[[Value]]) is *false*, Return *false*.
1. If SameValueNonGeneric(_xField_.[[Key]], _yField_.[[Key]]) is *false*, Return *false*.
1. If _elementEqual_(_xField_.[[Value]], _yField_.[[Value]]) is *false*, Return *false*.
1. Set _k_ to _k_ + 1.
1. Return *true*.
</emu-alg>
Expand All @@ -60,14 +60,14 @@ <h1>
RecordSameValue (
_x_: a Record,
_y_: a Record,
)
): a Boolean
</ins>
</h1>
<dl class="header"></dl>
<emu-alg>
1. Let _elementEqual_ be a new Abstract Closure with parameters (_elementX_, _elementY_) that captures no values and performs the following steps when called:
1. Return ! SameValue(_elementX_, _elementY_).
1. Return ! RecordEqual(_x_, _y_, _elementEqual_).
1. Return SameValue(_elementX_, _elementY_).
1. Return RecordEqual(_x_, _y_, _elementEqual_).
</emu-alg>
</emu-clause>

Expand All @@ -77,14 +77,14 @@ <h1>
RecordSameValueZero (
_x_: a Record,
_y_: a Record,
)
): a Boolean
</ins>
</h1>
<dl class="header"></dl>
<emu-alg>
1. Let _elementEqual_ be a new Abstract Closure with parameters (_elementX_, _elementY_) that captures no values and performs the following steps when called:
1. Return ! SameValueZero(_elementX_, _elementY_).
1. Return ! RecordEqual(_x_, _y_, _elementEqual_).
1. Return SameValueZero(_elementX_, _elementY_).
1. Return RecordEqual(_x_, _y_, _elementEqual_).
</emu-alg>
</emu-clause>
</emu-clause>
Expand All @@ -98,7 +98,7 @@ <h1>
<ins>
TupleToString (
_argument_: a Tuple,
)
): either a normal completion containing an ECMAScript language value, or an abrupt completion
</ins>
</h1>
<dl class="header"></dl>
Expand All @@ -114,7 +114,7 @@ <h1>
_x_: a Tuple,
_y_: a Tuple,
_elementEqual_: an Abstract Closure,
)
): a Boolean
</ins>
</h1>
<dl class="header"></dl>
Expand All @@ -128,7 +128,7 @@ <h1>
1. Repeat, while _k_ &lt; _xLen_,
1. Let _xItem_ be _xList_[_k_].
1. Let _yItem_ be _yList_[_k_].
1. If ! _elementEqual_(_xItem_, _yItem_) is *false*, Return *false*.
1. If _elementEqual_(_xItem_, _yItem_) is *false*, Return *false*.
1. Set _k_ to _k_ + 1.
1. Return *true*.
</emu-alg>
Expand All @@ -140,14 +140,14 @@ <h1>
TupleSameValue (
_x_: a Tuple,
_y_: a Tuple,
)
): a Boolean
</ins>
</h1>
<dl class="header"></dl>
<emu-alg>
1. Let _elementEqual_ be a new Abstract Closure with parameters (_elementX_, _elementY_) that captures no values and performs the following steps when called:
1. Return ! SameValue(_elementX_, _elementY_).
1. Return ! TupleEqual(_x_, _y_, _elementEqual_).
1. Return SameValue(_elementX_, _elementY_).
1. Return TupleEqual(_x_, _y_, _elementEqual_).
</emu-alg>
</emu-clause>

Expand All @@ -157,14 +157,14 @@ <h1>
TupleSameValueZero (
_x_: a Tuple,
_y_: a Tuple,
)
): a Boolean
</ins>
</h1>
<dl class="header"></dl>
<emu-alg>
1. Let _elementEqual_ be a new Abstract Closure with parameters (_elementX_, _elementY_) that captures no values and performs the following steps when called:
1. Return ! SameValueZero(_elementX_, _elementY_).
1. Return ! TupleEqual(_x_, _y_, _elementEqual_).
1. Return SameValueZero(_elementX_, _elementY_).
1. Return TupleEqual(_x_, _y_, _elementEqual_).
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down
4 changes: 2 additions & 2 deletions spec/expression.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h1>Runtime Semantics: Evaluation</h1>
1. Let _entries_ be an empty List.
1. Perform ? RecordPropertyDefinitionEvaluation of |RecordPropertyDefinitionList| with argument _entries_.
1. Let _uniqueEntries_ be DeduplicateRecordEntries(_entries_).
1. Return ! CreateRecord(_uniqueEntries_).
1. Return CreateRecord(_uniqueEntries_).
</emu-alg>
</emu-clause>

Expand Down Expand Up @@ -170,7 +170,7 @@ <h1>Runtime Semantics: TupleSequenceAccumulation</h1>
1. Let _next_ be ? IteratorStep(_iteratorRecord_).
1. If _next_ is *false*, return _sequence_.
1. Let _nextValue_ be ? IteratorValue(_next_).
1. Let _completion_ be AddValueToTupleSequenceList(_sequence_, _nextValue_).
1. Let _completion_ be Completion(AddValueToTupleSequenceList(_sequence_, _nextValue_)).
1. If _completion_ is an abrupt completion, then
1. Return ? IteratorClose(_iteratorRecord_, _completion_).
</emu-alg>
Expand Down
6 changes: 3 additions & 3 deletions spec/immutable-data-structures.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1>Record ( _arg_ )</h1>
1. If Type(_value_) is Object, throw a *TypeError* exception.
1. Let _field_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }.
1. Append _field_ to the end of list _fields_.
1. Return ! CreateRecord(_fields_).
1. Return CreateRecord(_fields_).
</emu-alg>
</emu-clause>
</emu-clause>
Expand All @@ -55,7 +55,7 @@ <h1>Record.fromEntries ( _iterable_ )</h1>
1. Append _field_ to the end of list _fields_.
1. Perform ? AddEntriesFromIterable(*undefined*, _iterable_, _adder_).
1. Let _uniqueEntries_ be DeduplicateRecordEntries(_fields_).
1. Return ! CreateRecord(_uniqueEntries_).
1. Return CreateRecord(_uniqueEntries_).
</emu-alg>
<emu-note>
<p>The parameter _iterable_ is expected to be an object that implements an @@iterator method that returns an iterator object that produces a two element array-like object whose first element is a value that will be used as a Map key and whose second element is the value to associate with that key.</p>
Expand Down Expand Up @@ -331,7 +331,7 @@ <h1>Tuple.prototype.filter ( _callbackfn_ [ , _thisArg_ ] )</h1>
1. Let _k_ be 0.
1. Repeat, while _k_ &lt; _len_,
1. Let _kValue_ be _list_[_k_].
1. Let _selected_ be ! ToBoolean(? Call(_callbackfn_, _thisArg_, &laquo; _kValue_, _k_, _T_ &raquo;)).
1. Let _selected_ be ToBoolean(? Call(_callbackfn_, _thisArg_, &laquo; _kValue_, _k_, _T_ &raquo;)).
1. If _selected_ is *true*, then
1. Append _kValue_ to the end of list _newList_.
1. Set _k_ to _k_ + 1.
Expand Down
Loading

0 comments on commit 54d21ee

Please sign in to comment.