- From: Domenic Denicola <notifications@github.com>
- Date: Fri, 01 Dec 2017 00:35:52 +0000 (UTC)
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/860/review/80375282@github.com>
domenic commented on this pull request.
> @@ -83,15 +83,20 @@ exports.InvokeOrNoop = (O, P, args) => {
return Call(method, O, args);
};
-exports.PromiseInvokeOrNoop = (O, P, args) => {
- assert(O !== undefined);
- assert(IsPropertyKey(P));
- assert(Array.isArray(args));
+exports.PromiseInvoke = (F, V, args) => {
This is no longer an "Invoke", but instead a "Call". "Invokes" take (object, property name) pairs.
> @@ -1156,12 +1156,22 @@ function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underl
return InvokeOrNoop(underlyingSource, 'start', [stream._readableStreamController]);
}
- function pullAlgorithm() {
- return PromiseInvokeOrNoop(underlyingSource, 'pull', [stream._readableStreamController]);
+ // eslint-disable-next-line func-style
I see what you mean about the controller not existing yet being a problem for algorithm construction. Can we just move the single line
```js
const controller = Object.create(ReadableStreamDefaultController.prototype);
```
before the algorithm creation? Then perhaps pass that as a parameter to the SetUpXYZ() abstract ops? I guess maybe also move the line
```js
stream._readableStreamController = controller;
```
and then we can pass in `controller` instead of `stream` to the SetUpXYZ() ops.
> try {
- return Promise.resolve(exports.InvokeOrNoop(O, P, args));
- } catch (returnValueE) {
- return Promise.reject(returnValueE);
+ return Promise.resolve(Call(F, V, args));
+ } catch (value) {
+ return Promise.reject(value);
+ }
+};
+
+exports.GetMethod = (V, methodName) => {
This might end up inlined into whatever helper is used for deduping the algorithm creation code.
> }
- function cancelAlgorithm(reason) {
- return PromiseInvokeOrNoop(underlyingSource, 'cancel', [reason]);
+ // eslint-disable-next-line func-style
We should probably just disable this lint in the eslintrc, given that it's hurting us repeatedly in this way. I don't like one-off lint disables like this in general.
> @@ -259,30 +259,44 @@ function SetUpTransformStreamDefaultController(stream, transformAlgorithm, flush
}
function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) {
- function transformAlgorithm(chunk) {
That got a lot simpler, yay.
--
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/860#pullrequestreview-80375282
Received on Friday, 1 December 2017 00:36:22 UTC