From 5079763ce7454da2f9147e814fc1b3668b644f94 Mon Sep 17 00:00:00 2001 From: solebox <5013box@gmail.com> Date: Tue, 1 Nov 2016 00:35:27 +0200 Subject: [PATCH] vm: name anonymous functions Name anonymous arrow function in vm module to improve readability PR-URL: https://github.com/nodejs/node/pull/9388 Reviewed-By: Luigi Pinca Reviewed-By: James Snell Reviewed-By: Benjamin Gruenbaum Ref: #8913 --- lib/vm.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/vm.js b/lib/vm.js index 73359c1b68..4869d36880 100644 --- a/lib/vm.js +++ b/lib/vm.js @@ -18,9 +18,10 @@ const realRunInContext = Script.prototype.runInContext; Script.prototype.runInThisContext = function(options) { if (options && options.breakOnSigint) { - return sigintHandlersWrap(() => { + const realRunInThisContextScript = () => { return realRunInThisContext.call(this, options); - }); + }; + return sigintHandlersWrap(realRunInThisContextScript); } else { return realRunInThisContext.call(this, options); } @@ -28,9 +29,10 @@ Script.prototype.runInThisContext = function(options) { Script.prototype.runInContext = function(contextifiedSandbox, options) { if (options && options.breakOnSigint) { - return sigintHandlersWrap(() => { + const realRunInContextScript = () => { return realRunInContext.call(this, contextifiedSandbox, options); - }); + }; + return sigintHandlersWrap(realRunInContextScript); } else { return realRunInContext.call(this, contextifiedSandbox, options); }