Skip to content

Commit 2530062

Browse files
committed
chore: switch to assert
1 parent 3765e06 commit 2530062

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/internal/vm/module.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const { fail } = require('internal/assert');
34
const {
45
ArrayIsArray,
56
ObjectCreate,
@@ -58,13 +59,9 @@ const kContext = Symbol('kContext');
5859
const kPerContextModuleId = Symbol('kPerContextModuleId');
5960
const kLink = Symbol('kLink');
6061

61-
// Helper caried over from js2c_macros: exits process and prints debug message
62-
// iff node_debug_lib flag is set.
63-
function CHECK(x) {
64-
if (process.config.variables.node_debug_lib === false) return;
65-
if (!x) {
66-
(process._rawDebug('CHECK: x == true'), process.abort());
67-
}
62+
function failIfDebug() {
63+
if (process.features.debug === false) return;
64+
fail('VM Modules');
6865
}
6966

7067
class Module {
@@ -127,7 +124,7 @@ class Module {
127124
syntheticExportNames,
128125
syntheticEvaluationSteps);
129126
} else {
130-
CHECK(false);
127+
failIfDebug();
131128
}
132129

133130
wrapToModuleMap.set(this[kWrap], this);
@@ -383,7 +380,7 @@ class SyntheticModule extends Module {
383380
identifier,
384381
});
385382

386-
this[kLink] = () => this[kWrap].link(() => { CHECK(false); });
383+
this[kLink] = () => this[kWrap].link(() => { failIfDebug(); });
387384
}
388385

389386
setExport(name, value) {

0 commit comments

Comments
 (0)