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 5dd9fb2

Browse filesBrowse files
addaleaxtargos
authored andcommitted
lib: further simplify assertions in vm/module
Refs: #30755 PR-URL: #30815 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent b6d09e8 commit 5dd9fb2
Copy full SHA for 5dd9fb2

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎lib/internal/vm/module.js‎

Copy file name to clipboardExpand all lines: lib/internal/vm/module.js
+6-10Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const { fail } = require('internal/assert');
3+
const assert = require('internal/assert');
44
const {
55
ArrayIsArray,
66
ObjectCreate,
@@ -60,11 +60,6 @@ const kContext = Symbol('kContext');
6060
const kPerContextModuleId = Symbol('kPerContextModuleId');
6161
const kLink = Symbol('kLink');
6262

63-
function failIfDebug() {
64-
if (process.features.debug === false) return;
65-
fail('VM Modules');
66-
}
67-
6863
class Module {
6964
constructor(options) {
7065
emitExperimentalWarning('VM Modules');
@@ -120,12 +115,11 @@ class Module {
120115
importModuleDynamicallyWrap(options.importModuleDynamically) :
121116
undefined,
122117
});
123-
} else if (syntheticEvaluationSteps) {
118+
} else {
119+
assert(syntheticEvaluationSteps);
124120
this[kWrap] = new ModuleWrap(identifier, context,
125121
syntheticExportNames,
126122
syntheticEvaluationSteps);
127-
} else {
128-
failIfDebug();
129123
}
130124

131125
wrapToModuleMap.set(this[kWrap], this);
@@ -381,7 +375,9 @@ class SyntheticModule extends Module {
381375
identifier,
382376
});
383377

384-
this[kLink] = () => this[kWrap].link(() => { failIfDebug(); });
378+
this[kLink] = () => this[kWrap].link(() => {
379+
assert.fail('link callback should not be called');
380+
});
385381
}
386382

387383
setExport(name, value) {

0 commit comments

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