lib: simplify function process.emitWarning

PR-URL: https://github.com/nodejs/node/pull/32992
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
himself65 2020-04-22 14:27:49 +08:00 committed by Ruben Bridgewater
parent e372b8b63e
commit 2c364d469b

View File

@ -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 = {