Re: [whatwg/streams] add @@asyncIterator to ReadableStream (#954)

domenic commented on this pull request.



> +</emu-alg>
+
+<h4 id="rs-asynciterator-prototype-return" method
+for="ReadableStreamAsyncIteratorPrototype">return( <var>value</var> )</h4>
+
+<emu-alg>
+  1. If ! IsReadableStreamAsyncIterator(*this*) is *false*, throw a *TypeError* exception.
+  1. Let _reader_ be *this*.[[asyncIteratorReader]].
+  1. If *this*.[[preventCancel]] is *false*, then:
+    1. If _reader_.[[ownerReadableStream]] is *undefined*, return <a>a promise rejected with</a> a *TypeError*
+    exception.
+    1. Let _result_ be ! ReadableStreamReaderGenericCancel(_reader_, _value_).
+  1. Otherwise,
+    1. Let _result_ be _value_.
+  1. Perform ! ReadableStreamReaderGenericRelease(_reader_).
+  1. Return <a>a promise resolved with</a> ! ReadableStreamCreateReadResult(_result_, *true*, *true*).

So now if `preventCancel` is false `return()` will give a promise for `{ value: promise for undefined, done: true }`. Whereas if it is true, `return()` will give a promise for `{ value: value, done: true }`. It should give the latter in both cases.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/954#pullrequestreview-153470894

Received on Friday, 7 September 2018 19:17:33 UTC