diff --git a/lib/internal/vm/module.js b/lib/internal/vm/module.js index cc42330cf24bfc..ee2fec2e431380 100644 --- a/lib/internal/vm/module.js +++ b/lib/internal/vm/module.js @@ -1,5 +1,6 @@ 'use strict'; +const { fail } = require('internal/assert'); const { ArrayIsArray, ObjectCreate, @@ -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 { @@ -127,7 +124,7 @@ class Module { syntheticExportNames, syntheticEvaluationSteps); } else { - CHECK(false); + failIfDebug(); } wrapToModuleMap.set(this[kWrap], this); @@ -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) {