From 2530062b7af868e48f57a83b927a0305d600452e Mon Sep 17 00:00:00 2001 From: bcoe Date: Wed, 4 Dec 2019 22:55:49 -0800 Subject: [PATCH] chore: switch to assert --- lib/internal/vm/module.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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) {