stream: simplify `createPromiseCallback` · nodejs/node@f00cdab
@@ -11,6 +11,7 @@ const {
1111 MathMax,
1212 NumberIsNaN,
1313 PromisePrototypeThen,
14+ ReflectApply,
1415 ReflectGet,
1516 Symbol,
1617 SymbolAsyncIterator,
@@ -166,15 +167,9 @@ function enqueueValueWithSize(controller, value, size) {
166167controller[kState].queueTotalSize += size;
167168}
168169169-// This implements "invoke a callback function type" for callback functions that return a promise.
170-// See https://webidl.spec.whatwg.org/#es-invoking-callback-functions
171-async function invokePromiseCallback(fn, thisArg, ...args) {
172-return FunctionPrototypeCall(fn, thisArg, ...args);
173-}
174-175170function createPromiseCallback(name, fn, thisArg) {
176171validateFunction(fn, name);
177-return (...args) => invokePromiseCallback(fn, thisArg, ...args);
172+return async (...args) => ReflectApply(fn, thisArg, args);
178173}
179174180175function isPromisePending(promise) {
@@ -281,7 +276,6 @@ module.exports = {
281276 extractHighWaterMark,
282277 extractSizeAlgorithm,
283278 lazyTransfer,
284- invokePromiseCallback,
285279 isBrandCheck,
286280 isPromisePending,
287281 peekQueueValue,