Skip to content

Commit

Permalink
chore: switch to assert
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Dec 5, 2019
1 parent 3765e06 commit 2530062
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/internal/vm/module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const { fail } = require('internal/assert');
const {
ArrayIsArray,
ObjectCreate,
Expand Down Expand Up @@ -58,13 +59,9 @@ const kContext = Symbol('kContext');
const kPerContextModuleId = Symbol('kPerContextModuleId');
const kLink = Symbol('kLink');

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

class Module {
Expand Down Expand Up @@ -127,7 +124,7 @@ class Module {
syntheticExportNames,
syntheticEvaluationSteps);
} else {
CHECK(false);
failIfDebug();
}

wrapToModuleMap.set(this[kWrap], this);
Expand Down Expand Up @@ -383,7 +380,7 @@ class SyntheticModule extends Module {
identifier,
});

this[kLink] = () => this[kWrap].link(() => { CHECK(false); });
this[kLink] = () => this[kWrap].link(() => { failIfDebug(); });
}

setExport(name, value) {
Expand Down

0 comments on commit 2530062

Please sign in to comment.