diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-12-06 03:09:09 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2019-12-23 21:06:29 +0300 |
commit | db109e85d678faf581433250bb1442f5eb24de61 (patch) | |
tree | ba78fd0b3cce363f9867d1f22302d1796f77f396 /lib | |
parent | 05041d3ab1ed4e25f44406ebc288e3961f2b0299 (diff) |
lib: further simplify assertions in vm/module
Refs: https://github.com/nodejs/node/pull/30755
PR-URL: https://github.com/nodejs/node/pull/30815
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/vm/module.js | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/internal/vm/module.js b/lib/internal/vm/module.js index 9e6aa6b6b87..2a89165409d 100644 --- a/lib/internal/vm/module.js +++ b/lib/internal/vm/module.js @@ -1,6 +1,6 @@ 'use strict'; -const { fail } = require('internal/assert'); +const assert = require('internal/assert'); const { ArrayIsArray, ObjectCreate, @@ -59,11 +59,6 @@ const kContext = Symbol('kContext'); const kPerContextModuleId = Symbol('kPerContextModuleId'); const kLink = Symbol('kLink'); -function failIfDebug() { - if (process.features.debug === false) return; - fail('VM Modules'); -} - class Module { constructor(options) { emitExperimentalWarning('VM Modules'); @@ -119,12 +114,11 @@ class Module { importModuleDynamicallyWrap(options.importModuleDynamically) : undefined, }); - } else if (syntheticEvaluationSteps) { + } else { + assert(syntheticEvaluationSteps); this[kWrap] = new ModuleWrap(identifier, context, syntheticExportNames, syntheticEvaluationSteps); - } else { - failIfDebug(); } wrapToModuleMap.set(this[kWrap], this); @@ -380,7 +374,9 @@ class SyntheticModule extends Module { identifier, }); - this[kLink] = () => this[kWrap].link(() => { failIfDebug(); }); + this[kLink] = () => this[kWrap].link(() => { + assert.fail('link callback should not be called'); + }); } setExport(name, value) { |