Open Jack-Works opened 2 months ago
Should it instead say Perform ! _value _
, or just prepend a !
on the Call step that references it?
_value_
gets unwrapped by ReturnIfAbrupt already; the problem is that the new logic is failing to account for ReturnIfAbrupt and friends.
That said, I'd write the above code as
1. If _value_ is an abrupt completion, then
1. Set _iterator_.[[Done]] to *true*.
1. Return ? _value_.
instead of using ReturnIfAbrupt.
(Though in fact the correct thing these days is to use IteratorStepValue
, which handles setting _iterator_.[[Done]]
already.)
Right, I meant, remove the ReturnIfAbrupt step and let a !
handle it in the next step.
You can't use !
because it might actually be abrupt, at least as currently written. But yes, you can unwrap with Set _iteratorResult_ to ? _iteratorResult_.
, and that would also be better.
(I actually kind of want to get rid of ReturnIfAbrupt entirely, though we'll still need IfAbruptCloseIterator and IfAbruptRejectPromise.)
Can I 1. ? _value_
?
No, but you can Set _value_ to ? _value_
. Or if you already know that _value_
is definitely an abrupt completion, you can Return ? _value_
.
You can also Perform ? _value_.
but the assignment is probably clearer.
We only use Perform
when invoking AOs or SDOs.
it warns for the following code after upgrading from 19.1.0 to 20.0.0. It uses ReturnIfAbrupt.