diff --git a/spec.html b/spec.html
index 0f887580ae6..3a5777730a7 100644
--- a/spec.html
+++ b/spec.html
@@ -7005,10 +7005,21 @@
It requests the next value from _iteratorRecord_.[[Iterator]] by calling _iteratorRecord_.[[NextMethod]] and returns either *false* indicating that the iterator has reached its end or the value from the iterator result object if a next value is available.
- 1. Let _result_ be ? IteratorNext(_iteratorRecord_).
- 1. Let _done_ be ? IteratorComplete(_result_).
- 1. If _done_ is *true*, return ~done~.
- 1. Return ? Get(_result_, *"value"*).
+ 1. Let _result_ be Completion(IteratorNext(_iteratorRecord_)).
+ 1. If _result_ is an abrupt completion, then
+ 1. Set _iteratorRecord_.[[Done]] to *true*.
+ 1. Return ? _result_.
+ 1. Let _done_ be Completion(IteratorComplete(_result_)).
+ 1. If _done_ is an abrupt completion, then
+ 1. Set _iteratorRecord_.[[Done]] to *true*.
+ 1. Return ? _done_.
+ 1. If _done_ is *true*, then
+ 1. Set _iteratorRecord_.[[Done]] to *true*.
+ 1. Return ~done~.
+ 1. Let _value_ be Completion(Get(_result_, *"value"*)).
+ 1. If _value_ is an abrupt completion, then
+ 1. Set _iteratorRecord_.[[Done]] to *true*.
+ 1. Return ? _value_.
@@ -9572,12 +9583,8 @@
1. Let _lhs_ be ? ResolveBinding(_bindingId_, _environment_).
1. Let _v_ be *undefined*.
1. If _iteratorRecord_.[[Done]] is *false*, then
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
- 1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
- 1. Else,
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
+ 1. If _next_ is not ~done~, then
1. Set _v_ to _next_.
1. If |Initializer| is present and _v_ is *undefined*, then
1. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then
@@ -9592,12 +9599,8 @@
1. Let _v_ be *undefined*.
1. If _iteratorRecord_.[[Done]] is *false*, then
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
- 1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
- 1. Else,
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
+ 1. If _next_ is not ~done~, then
1. Set _v_ to _next_.
1. If |Initializer| is present and _v_ is *undefined*, then
1. Let _defaultValue_ be ? Evaluation of |Initializer|.
@@ -9611,10 +9614,7 @@
1. Let _n_ be 0.
1. Repeat,
1. If _iteratorRecord_.[[Done]] is *false*, then
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
- 1. If _next_ is ~done~, set _iteratorRecord_.[[Done]] to *true*.
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
1. If _iteratorRecord_.[[Done]] is *true*, then
1. If _environment_ is *undefined*, return ? PutValue(_lhs_, _A_).
1. Return ? InitializeReferencedBinding(_lhs_, _A_).
@@ -9627,10 +9627,7 @@
1. Let _n_ be 0.
1. Repeat,
1. If _iteratorRecord_.[[Done]] is *false*, then
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
- 1. If _next_ is ~done~, set _iteratorRecord_.[[Done]] to *true*.
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
1. If _iteratorRecord_.[[Done]] is *true*, then
1. Return ? BindingInitialization of |BindingPattern| with arguments _A_ and _environment_.
1. Perform ! CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_n_)), _next_).
@@ -9654,12 +9651,8 @@
1. Let _v_ be *undefined*.
1. Assert: _iteratorRecord_.[[Done]] is *false*.
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
- 1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
- 1. Else,
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
+ 1. If _next_ is not ~done~, then
1. Set _v_ to _next_.
1. Return ? BindingInitialization of |BindingIdentifier| with arguments _v_ and _environment_.
@@ -9674,12 +9667,8 @@
1. Let _v_ be *undefined*.
1. Assert: _iteratorRecord_.[[Done]] is *false*.
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
- 1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
- 1. Else,
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
+ 1. If _next_ is not ~done~, then
1. Set _v_ to _next_.
1. Return ? BindingInitialization of |BindingIdentifier| with arguments _v_ and _environment_.
@@ -21009,12 +20998,8 @@
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Let _lref_ be ? Evaluation of |DestructuringAssignmentTarget|.
1. If _iteratorRecord_.[[Done]] is *false*, then
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
- 1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
- 1. Else,
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
+ 1. If _next_ is not ~done~, then
1. Let _value_ be _next_.
1. If _iteratorRecord_.[[Done]] is *true*, let _value_ be *undefined*.
1. If |Initializer| is present and _value_ is *undefined*, then
@@ -21040,12 +21025,8 @@
1. Let _A_ be ! ArrayCreate(0).
1. Let _n_ be 0.
1. Repeat, while _iteratorRecord_.[[Done]] is *false*,
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
- 1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
- 1. Else,
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
+ 1. If _next_ is not ~done~, then
1. Perform ! CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_n_)), _next_).
1. Set _n_ to _n_ + 1.
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
@@ -46648,11 +46629,8 @@
1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }.
1. Let _index_ be 0.
1. Repeat,
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1.
1. If _remainingElementsCount_.[[Value]] = 0, then
1. Let _valuesArray_ be CreateArrayFromList(_values_).
@@ -46733,11 +46711,8 @@
1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }.
1. Let _index_ be 0.
1. Repeat,
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1.
1. If _remainingElementsCount_.[[Value]] = 0, then
1. Let _valuesArray_ be CreateArrayFromList(_values_).
@@ -46857,11 +46832,8 @@
1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }.
1. Let _index_ be 0.
1. Repeat,
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1.
1. If _remainingElementsCount_.[[Value]] = 0, then
1. Let _error_ be a newly created *AggregateError* object.
@@ -46950,11 +46922,8 @@
1. Repeat,
- 1. Let _next_ be Completion(IteratorStepValue(_iteratorRecord_)).
- 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
- 1. ReturnIfAbrupt(_next_).
+ 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_).
1. If _next_ is ~done~, then
- 1. Set _iteratorRecord_.[[Done]] to *true*.
1. Return _resultCapability_.[[Promise]].
1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _next_ »).
1. Perform ? Invoke(_nextPromise_, *"then"*, « _resultCapability_.[[Resolve]], _resultCapability_.[[Reject]] »).