Re: [whatwg/streams] Remove TransformStreamDefaultSinkDefaultTransform (#823)

domenic approved this pull request.

LGTM with nits. Will fix nits and merge myself.

> @@ -295,9 +295,18 @@ class TransformStreamDefaultSink {
   }
 }
 
-function TransformStreamDefaultSinkDefaultTransform(chunk, controller) {
-  TransformStreamDefaultControllerEnqueue(controller, chunk);
-  return Promise.resolve();
+function TransformStreamDefaultSinkInvokeTransform(stream, chunk) {
+  const controller = stream._transformStreamController;
+  const transformer = stream._transformer;
+
+  const method = transformer.transform; // throws
+
+  if (method === undefined) {
+    TransformStreamDefaultControllerEnqueue(controller, chunk); // throws
+    return undefined; // explicit "undefined" to keep eslint happy.

I don't think we need this comment. We do the same thing in lots of places.

> @@ -295,9 +295,18 @@ class TransformStreamDefaultSink {
   }
 }
 
-function TransformStreamDefaultSinkDefaultTransform(chunk, controller) {
-  TransformStreamDefaultControllerEnqueue(controller, chunk);
-  return Promise.resolve();
+function TransformStreamDefaultSinkInvokeTransform(stream, chunk) {
+  const controller = stream._transformStreamController;
+  const transformer = stream._transformer;
+
+  const method = transformer.transform; // throws

Although I realize they are emulating the spec annotations, these comments would be clearer as "can throw", IMO.

-- 
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/823#pullrequestreview-67756442

Received on Friday, 6 October 2017 18:34:48 UTC