From 944dceb6189690e75d3176b900af5f66543fd35c Mon Sep 17 00:00:00 2001 From: himself65 Date: Wed, 22 Apr 2020 14:27:49 +0800 Subject: [PATCH] lib: simplify function process.emitWarning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/32992 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Andrey Pechkurov Reviewed-By: Ruben Bridgewater Reviewed-By: Juan José Arboleda Reviewed-By: James M Snell --- lib/internal/process/warning.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/process/warning.js b/lib/internal/process/warning.js index 18dd8e9e03d1c6..d12618ccf4826e 100644 --- a/lib/internal/process/warning.js +++ b/lib/internal/process/warning.js @@ -54,7 +54,7 @@ function writeToFile(message) { } function doEmitWarning(warning) { - return () => process.emit('warning', warning); + process.emit('warning', warning); } let traceWarningHelperShown = false; @@ -140,7 +140,7 @@ function emitWarning(warning, type, code, ctor, now) { throw warning; } if (now) process.emit('warning', warning); - else process.nextTick(doEmitWarning(warning)); + else process.nextTick(doEmitWarning, warning); } module.exports = {