From c4615540aa20573ae1943ffdc70b65c269f2324e Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Mon, 28 Sep 2026 19:38:23 -0700 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A4=96=20Update=20spec.emu=20to=20ref?= =?UTF-8?q?lect=202026-09=20Stage=202=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- spec.emu | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/spec.emu b/spec.emu index 46fa79a..3d56097 100644 --- a/spec.emu +++ b/spec.emu @@ -5,7 +5,7 @@
 title: Intl Sequence Units
-stage: 0
+stage: 2
 contributors: Shane F Carr
 
@@ -125,6 +125,8 @@ contributors: Shane F Carr 1. Else, 1. Let _mxfdDefault_ be 3. 1. Perform ? SetNumberFormatDigitOptions(_numberFormat_, _options_, _mnfdDefault_, _mxfdDefault_, _notation_). + 1. If _style_ is *"unit"* and StringIndexOf(_numberFormat_.[[Unit]], *"-and-"*, 0) is not ~not-found~, then + 1. If _numberFormat_.[[RoundingType]] is not ~fraction-digits~, throw a *RangeError* exception. 1. Let _compactDisplay_ be ? GetOption(_options_, *"compactDisplay"*, ~string~, « *"short"*, *"long"* », *"short"*). 1. Let _defaultUseGrouping_ be *"auto"*. 1. If _notation_ is *"compact"*, then @@ -209,14 +211,15 @@ contributors: Shane F Carr 1. If _value_ is not an Object, throw a *TypeError* exception. 1. Let _sequence_ be StringSplitToList(_unit_, *"-and-"*). + 1. Let _iterableValues_ be ? IterableToList(_value_). + 1. If the length of _iterableValues_ is not the length of _sequence_, throw a *RangeError* exception. 1. Let _values_ be a new empty List. 1. Let _hasNegative_ be *false*. 1. Let _hasPositive_ be *false*. 1. Let _hasNonInteger_ be *false*. 1. Let _i_ be 0. - 1. For each String _subUnit_ of _sequence_, do + 1. For each ECMAScript language value _subValue_ of _iterableValues_, do 1. If _i_ is the length of _sequence_ - 1, let _isLast_ be *true*; else let _isLast_ be *false*. - 1. Let _subValue_ be ? Get(_value_, _subUnit_). 1. If _subValue_ is *undefined*, throw a *TypeError* exception. 1. Let _x_ be ? ToIntlMathematicalValue(_subValue_). 1. If _isLast_ is *false* and _x_ is not an integer, set _hasNonInteger_ to *true*. @@ -288,6 +291,7 @@ contributors: Shane F Carr 1. Assert: _numberFormat_.[[Style]] is *"unit"* and StringIndexOf(_numberFormat_.[[Unit]], *"-and-"*, 0) is not ~not-found~. + 1. Assert: _numberFormat_.[[RoundingType]] is ~fraction-digits~. 1. Let _sequence_ be StringSplitToList(_numberFormat_.[[Unit]], *"-and-"*). 1. Let _partitionedPartsList_ be a new empty List. 1. Let _lfOpts_ be OrdinaryObjectCreate(*null*). @@ -296,11 +300,8 @@ contributors: Shane F Carr 1. Let _lf_ be ! Construct(%Intl.ListFormat%, « _numberFormat_.[[Locale]], _lfOpts_ »). 1. Let _strings_ be a new empty List. 1. Let _originalUnit_ be _numberFormat_.[[Unit]]. - 1. Let _originalRoundingType_ be _numberFormat_.[[RoundingType]]. 1. Let _originalMinFD_ be _numberFormat_.[[MinimumFractionDigits]]. 1. Let _originalMaxFD_ be _numberFormat_.[[MaximumFractionDigits]]. - 1. Let _originalMinSD_ be _numberFormat_.[[MinimumSignificantDigits]]. - 1. Let _originalMaxSD_ be _numberFormat_.[[MaximumSignificantDigits]]. 1. Let _i_ be 0. 1. For each Intl mathematical value _x_ of _values_, do 1. If _i_ is 0, let _isFirst_ be *true*; else let _isFirst_ be *false*. @@ -311,15 +312,11 @@ contributors: Shane F Carr 1. Let _subUnit_ be _sequence_[_i_]. 1. Set _numberFormat_.[[Unit]] to _subUnit_. 1. If _isLast_ is *false*, then - 1. Set _numberFormat_.[[RoundingType]] to ~fraction-digits~. 1. Set _numberFormat_.[[MinimumFractionDigits]] to 0. 1. Set _numberFormat_.[[MaximumFractionDigits]] to 3. 1. Else, - 1. Set _numberFormat_.[[RoundingType]] to _originalRoundingType_. 1. Set _numberFormat_.[[MinimumFractionDigits]] to _originalMinFD_. 1. Set _numberFormat_.[[MaximumFractionDigits]] to _originalMaxFD_. - 1. Set _numberFormat_.[[MinimumSignificantDigits]] to _originalMinSD_. - 1. Set _numberFormat_.[[MaximumSignificantDigits]] to _originalMaxSD_. 1. Let _parts_ be PartitionNumberPattern(_numberFormat_, _x_). 1. Append _parts_ to _partitionedPartsList_. 1. Let _string_ be the empty String. From 2ed6456e6dc643103446b3a8212f33968dfb265e Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Tue, 29 Sep 2026 23:02:27 -0700 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A4=96=20Use=20GetIterator=20and=20It?= =?UTF-8?q?eratorToList=20instead=20of=20IterableToList=20in=20spec.emu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- spec.emu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec.emu b/spec.emu index 3d56097..562f17e 100644 --- a/spec.emu +++ b/spec.emu @@ -211,7 +211,8 @@ contributors: Shane F Carr 1. If _value_ is not an Object, throw a *TypeError* exception. 1. Let _sequence_ be StringSplitToList(_unit_, *"-and-"*). - 1. Let _iterableValues_ be ? IterableToList(_value_). + 1. Let _iteratorRecord_ be ? GetIterator(_value_, ~sync~). + 1. Let _iterableValues_ be ? IteratorToList(_iteratorRecord_). 1. If the length of _iterableValues_ is not the length of _sequence_, throw a *RangeError* exception. 1. Let _values_ be a new empty List. 1. Let _hasNegative_ be *false*.