Skip to content
Permalink
Browse files

vm: name anonymous functions

Name anonymous arrow function in vm module to improve readability

PR-URL: #9388
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <inglor@gmail.com>
Ref: #8913
  • Loading branch information...
solebox authored and benjamingr committed Oct 31, 2016
1 parent f8f67d2 commit 5079763ce7454da2f9147e814fc1b3668b644f94
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/vm.js
@@ -18,19 +18,21 @@ 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);
}
};

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);
}

0 comments on commit 5079763

Please sign in to comment.
You can’t perform that action at this time.