[whatwg/streams] Add Reader Type assertions (#1095)

This adds reader type assertions to the beginning of several ReadableStream abstract operations that are only called with one particular type of reader for added clarity.

For example, [ReadableStreamFulfillReadIntoRequest](https://streams.spec.whatwg.org/commit-snapshots/0f419d59b58dde19a08f0a308561cef8ab8b99d5/#readable-stream-fulfill-read-into-request) and [ReadableStreamGetNumReadIntoRequests](https://streams.spec.whatwg.org/commit-snapshots/0f419d59b58dde19a08f0a308561cef8ab8b99d5/#readable-stream-get-num-read-into-requests) should only be called with ReadableStreamBYOBReader. Hence, we add the assertion:

> Assert: _stream_.[[reader]] implements **ReadableStreamBYOBReader**.

Similarly, [ReadableStreamFulfillReadRequest](https://streams.spec.whatwg.org/commit-snapshots/0f419d59b58dde19a08f0a308561cef8ab8b99d5/#readable-stream-fulfill-read-request) and [ReadableStreamGetNumReadRequests](https://streams.spec.whatwg.org/commit-snapshots/0f419d59b58dde19a08f0a308561cef8ab8b99d5/#readable-stream-get-num-read-requests) should only be called with ReadableStreamDefaultReader. Hence, we add the assertion:

> Assert: _stream_.[[reader]] implements **ReadableStreamDefaultReader**.

Closes https://github.com/whatwg/streams/issues/1094.
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/streams/pull/1095

-- Commit Summary --

  * Merge pull request #1 from whatwg/master
  * Merge pull request #2 from whatwg/master
  * Merge pull request #3 from whatwg/master
  * Merge remote-tracking branch 'upstream/master'
  * Add reader type assertions

-- File Changes --

    M index.bs (4)

-- Patch Links --

https://github.com/whatwg/streams/pull/1095.patch
https://github.com/whatwg/streams/pull/1095.diff

-- 
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/1095

Received on Friday, 4 December 2020 02:06:00 UTC