Skip to content

Commit

Permalink
Move readIntoRequest to last argument
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Sep 16, 2023
1 parent d17aeca commit e381f25
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ value: newViewOnSameMemory, done: true }</code> for closed streams. If the strea
: [=read-into request/error steps=], given |e|
::
1. [=Reject=] |promise| with |e|.
1. Perform ! [$ReadableStreamBYOBReaderRead$]([=this=], |view|, |readIntoRequest|, |options|["{{ReadableStreamBYOBReaderReadOptions/min}}"]).
1. Perform ! [$ReadableStreamBYOBReaderRead$]([=this=], |view|, |options|["{{ReadableStreamBYOBReaderReadOptions/min}}"], |readIntoRequest|).
1. Return |promise|.
</div>

Expand Down Expand Up @@ -2581,7 +2581,7 @@ create them does not matter.
: [=read-into request/error steps=]
::
1. Set |reading| to false.
1. Perform ! [$ReadableStreamBYOBReaderRead$](|reader|, |view|, |readIntoRequest|, 1).
1. Perform ! [$ReadableStreamBYOBReaderRead$](|reader|, |view|, 1, |readIntoRequest|).
1. Let |pull1Algorithm| be the following steps:
1. If |reading| is true,
1. Set |readAgainForBranch1| to true.
Expand Down Expand Up @@ -2881,16 +2881,16 @@ The following abstract operations support the implementation and manipulation of

<div algorithm>
<dfn abstract-op lt="ReadableStreamBYOBReaderRead"
id="readable-stream-byob-reader-read">ReadableStreamBYOBReaderRead(|reader|, |view|,
|readIntoRequest|, |min|)</dfn> performs the following steps:
id="readable-stream-byob-reader-read">ReadableStreamBYOBReaderRead(|reader|, |view|, |min|,
|readIntoRequest|)</dfn> performs the following steps:

1. Let |stream| be |reader|.[=ReadableStreamGenericReader/[[stream]]=].
1. Assert: |stream| is not undefined.
1. Set |stream|.[=ReadableStream/[[disturbed]]=] to true.
1. If |stream|.[=ReadableStream/[[state]]=] is "`errored`", perform |readIntoRequest|'s [=read-into
request/error steps=] given |stream|.[=ReadableStream/[[storedError]]=].
1. Otherwise, perform ! [$ReadableByteStreamControllerPullInto$](|stream|.[=ReadableStream/[[controller]]=],
|view|, |readIntoRequest|, |min|).
|view|, |min|, |readIntoRequest|).
</div>

<div algorithm>
Expand Down Expand Up @@ -3570,7 +3570,7 @@ The following abstract operations support the implementation of the
<div algorithm>
<dfn abstract-op lt="ReadableByteStreamControllerPullInto"
id="readable-byte-stream-controller-pull-into">ReadableByteStreamControllerPullInto(|controller|,
|view|, |readIntoRequest|, |min|)</dfn> performs the following steps:
|view|, |min|, |readIntoRequest|)</dfn> performs the following steps:

1. Let |stream| be |controller|.[=ReadableByteStreamController/[[stream]]=].
1. Let |elementSize| be 1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ReadableStreamBYOBReaderImpl {
closeSteps: chunk => resolvePromise(promise, { value: chunk, done: true }),
errorSteps: e => rejectPromise(promise, e)
};
aos.ReadableStreamBYOBReaderRead(this, view, readIntoRequest, options.min);
aos.ReadableStreamBYOBReaderRead(this, view, options.min, readIntoRequest);
return promise;
}

Expand Down
8 changes: 4 additions & 4 deletions reference-implementation/lib/abstract-ops/readable-streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ function ReadableByteStreamTee(stream) {
reading = false;
}
};
ReadableStreamBYOBReaderRead(reader, view, readIntoRequest, 1);
ReadableStreamBYOBReaderRead(reader, view, 1, readIntoRequest);
}

function pull1Algorithm() {
Expand Down Expand Up @@ -913,7 +913,7 @@ function ReadableStreamReaderGenericRelease(reader) {
reader._stream = undefined;
}

function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest, min) {
function ReadableStreamBYOBReaderRead(reader, view, min, readIntoRequest) {
const stream = reader._stream;

assert(stream !== undefined);
Expand All @@ -923,7 +923,7 @@ function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest, min) {
if (stream._state === 'errored') {
readIntoRequest.errorSteps(stream._storedError);
} else {
ReadableByteStreamControllerPullInto(stream._controller, view, readIntoRequest, min);
ReadableByteStreamControllerPullInto(stream._controller, view, min, readIntoRequest);
}
}

Expand Down Expand Up @@ -1562,7 +1562,7 @@ function ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller) {
}
}

function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest, min) {
function ReadableByteStreamControllerPullInto(controller, view, min, readIntoRequest) {
const stream = controller._stream;

let elementSize = 1;
Expand Down

0 comments on commit e381f25

Please sign in to comment.