From 88dd3387f412fec341eb7324f66a49739f54546a Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 11 Aug 2017 13:25:41 +0200 Subject: [PATCH] lib: move deprecationWarned var The variable deprecationWarned currently looks a little misplaced. It is used in emitWarning but declared after it. This commit suggest moving the var to the beginning of the function. --- lib/internal/process/promises.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/process/promises.js b/lib/internal/process/promises.js index 1ba4aa47f575bf..6b6384e6a347fe 100644 --- a/lib/internal/process/promises.js +++ b/lib/internal/process/promises.js @@ -14,6 +14,8 @@ function getAsynchronousRejectionWarningObject(uid) { } function setupPromises(scheduleMicrotasks) { + var deprecationWarned = false; + process._setupPromises(function(event, promise, reason) { if (event === promiseRejectEvent.unhandled) unhandledRejection(promise, reason); @@ -73,7 +75,7 @@ function setupPromises(scheduleMicrotasks) { 'DeprecationWarning', 'DEP0018'); } } - var deprecationWarned = false; + function emitPendingUnhandledRejections() { let hadListeners = false; while (pendingUnhandledRejections.length > 0) {