Skip to content

Commit

Permalink
vm: name anonymous functions
Browse files Browse the repository at this point in the history
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 Nov 6, 2016
1 parent f8f67d2 commit 5079763
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 5079763

Please sign in to comment.