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 <[email protected]>
Reviewed-By: James Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Ref: #8913
  • Loading branch information
solebox authored and evanlucas committed Nov 7, 2016
1 parent 6eb6816 commit b083086
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 b083086

Please sign in to comment.