Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4b2aa3d

Browse filesBrowse files
XadillaXMoLow
authored andcommitted
vm,lib: refactor microtaskQueue assignment logic
Simplify the assignment of the `microtaskQueue` variable in the `vm` module by replacing the conditional block with a more concise ternary operator. This change improves code readability and maintainability. PR-URL: #47765 Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 3460cf9 commit 4b2aa3d
Copy full SHA for 4b2aa3d

File tree

Expand file treeCollapse file tree

1 file changed

+6
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-8
lines changed
Open diff view settings
Collapse file

‎lib/vm.js‎

Copy file name to clipboardExpand all lines: lib/vm.js
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,12 @@ function createContext(contextObject = {}, options = kEmptyObject) {
236236
validateBoolean(wasm, 'options.codeGeneration.wasm');
237237
}
238238

239-
let microtaskQueue = null;
240-
if (microtaskMode !== undefined) {
241-
validateOneOf(microtaskMode, 'options.microtaskMode',
242-
['afterEvaluate', undefined]);
243-
244-
if (microtaskMode === 'afterEvaluate')
245-
microtaskQueue = new MicrotaskQueue();
246-
}
239+
validateOneOf(microtaskMode,
240+
'options.microtaskMode',
241+
['afterEvaluate', undefined]);
242+
const microtaskQueue = microtaskMode === 'afterEvaluate' ?
243+
new MicrotaskQueue() :
244+
null;
247245

248246
makeContext(contextObject, name, origin, strings, wasm, microtaskQueue);
249247
return contextObject;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.