From 98b30b06ff8ef32b70be2b4e5fcf867a41f1d45f 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 383bbd7e0fe79f..ebf4c932fa9c57 100644 --- a/lib/internal/process/warning.js +++ b/lib/internal/process/warning.js @@ -55,7 +55,7 @@ function writeToFile(message) { } function doEmitWarning(warning) { - return () => process.emit('warning', warning); + process.emit('warning', warning); } let traceWarningHelperShown = false; @@ -129,7 +129,7 @@ function emitWarning(warning, type, code, ctor) { if (process.throwDeprecation) throw warning; } - process.nextTick(doEmitWarning(warning)); + process.nextTick(doEmitWarning, warning); } function emitWarningSync(warning) {