Browse Source

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 <luigipinca@gmail.com>
Reviewed-By: James Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <inglor@gmail.com>
Ref: #8913
v6
solebox 8 years ago
committed by Benjamin Gruenbaum
parent
commit
5079763ce7
  1. 10
      lib/vm.js

10
lib/vm.js

@ -18,9 +18,10 @@ const realRunInContext = Script.prototype.runInContext;
Script.prototype.runInThisContext = function(options) { Script.prototype.runInThisContext = function(options) {
if (options && options.breakOnSigint) { if (options && options.breakOnSigint) {
return sigintHandlersWrap(() => { const realRunInThisContextScript = () => {
return realRunInThisContext.call(this, options); return realRunInThisContext.call(this, options);
}); };
return sigintHandlersWrap(realRunInThisContextScript);
} else { } else {
return realRunInThisContext.call(this, options); return realRunInThisContext.call(this, options);
} }
@ -28,9 +29,10 @@ Script.prototype.runInThisContext = function(options) {
Script.prototype.runInContext = function(contextifiedSandbox, options) { Script.prototype.runInContext = function(contextifiedSandbox, options) {
if (options && options.breakOnSigint) { if (options && options.breakOnSigint) {
return sigintHandlersWrap(() => { const realRunInContextScript = () => {
return realRunInContext.call(this, contextifiedSandbox, options); return realRunInContext.call(this, contextifiedSandbox, options);
}); };
return sigintHandlersWrap(realRunInContextScript);
} else { } else {
return realRunInContext.call(this, contextifiedSandbox, options); return realRunInContext.call(this, contextifiedSandbox, options);
} }

Loading…
Cancel
Save