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
This commit is contained in:
parent
f8f67d253e
commit
5079763ce7
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…
x
Reference in New Issue
Block a user