summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/vm.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/vm.js b/lib/vm.js
index 1fdea84334..b48e79c282 100644
--- a/lib/vm.js
+++ b/lib/vm.js
@@ -235,14 +235,12 @@ function createContext(contextObject = {}, options = kEmptyObject) {
validateBoolean(wasm, 'options.codeGeneration.wasm');
}
- let microtaskQueue = null;
- if (microtaskMode !== undefined) {
- validateOneOf(microtaskMode, 'options.microtaskMode',
- ['afterEvaluate', undefined]);
-
- if (microtaskMode === 'afterEvaluate')
- microtaskQueue = new MicrotaskQueue();
- }
+ validateOneOf(microtaskMode,
+ 'options.microtaskMode',
+ ['afterEvaluate', undefined]);
+ const microtaskQueue = microtaskMode === 'afterEvaluate' ?
+ new MicrotaskQueue() :
+ null;
makeContext(contextObject, name, origin, strings, wasm, microtaskQueue);
return contextObject;