Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: switch to assert
  • Loading branch information
bcoe committed Dec 5, 2019
commit 2530062b7af868e48f57a83b927a0305d600452e
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