Re: [whatwg/streams] add @@asyncIterator to ReadableStreamDefaultReader (#950)

domenic commented on this pull request.



> +    stream">canceled</a> when the async iterator's {{ReadableStreamDefaultReaderAsyncIteratorPrototype/return()}} method
+    is called
+  </tr>
+</table>
+
+<h4 id="default-reader-asynciterator-prototype-next" method
+for="ReadableStreamDefaultReaderAsyncIteratorPrototype">next()</h4>
+
+<emu-alg>
+  1. If ! IsReadableStreamDefaultReaderAsyncIterator(*this*) is *false*, throw a *TypeError* exception.
+  1. Let _reader_ be *this*.[[asyncIteratorReader]].
+  1. Let _read_ be GetMethod(_reader_, `"read"`).
+  1. If _read_ is an abrupt completion, return <a>a promise rejected with</a> _read_.[[Value]].
+  1. Let _result_ be Call(_read_.[[Value]], _reader_).
+  1. If _result_ is an abrupt completion, return <a>a promise rejected with</a> _result_.[[Value]].
+  1. Return <a>a promise resolved with</a> _result_.[[Value]].

This is missing auto-release if _result_.[[Value]]'s `done` property is set to true, discussed in https://github.com/whatwg/streams/issues/778#issuecomment-371717821

> +  1. If _result_ is an abrupt completion, return <a>a promise rejected with</a> _result_.[[Value]].
+  1. Return <a>a promise resolved with</a> _result_.[[Value]].
+</emu-alg>
+
+<h4 id="default-reader-asynciterator-prototype-return" method for="ReadableStreamDefaultReaderAsyncIteratorPrototype">
+return( <var>value</var> )</h4>
+
+<emu-alg>
+  1. If ! IsReadableStreamDefaultReaderAsyncIterator(*this*) is *false*, throw a *TypeError* exception.
+  1. Let _reader_ be *this*.[[asyncIteratorReader]].
+  1. If *this*.[[preventCancel]] is *false*, then:
+    1. Let _cancel_ be GetMethod(_reader_, `"cancel"`).
+    1. If _cancel_ is an abrupt completion, return <a>a promise rejected with</a> _cancel_.[[Value]].
+    1. Let _result_ be Call(_cancel_.[[Value]], _reader_, &laquo; _value_ &raquo;).
+    1. If _result_ is an abrupt completion, return <a>a promise rejected with</a> _result_.[[Value]].
+  1. Return <a>a promise resolved with</a> ! ReadableStreamCreateReadResult(_value_, *true*, *true*).

This is missing auto-release, discussed in https://github.com/whatwg/streams/issues/778#issuecomment-371717821 . It should happen in both branches.

-- 
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/950#pullrequestreview-151095009

Received on Thursday, 30 August 2018 17:12:57 UTC