Skip to content
Permalink
Browse files

lib: further simplify assertions in vm/module

Refs: #30755

PR-URL: #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>
  • Loading branch information
addaleax authored and BridgeAR committed Dec 6, 2019
1 parent 7e13ae7 commit 614b2c58f0b39139d54b63b2dcebbadaa41d15fe
Showing with 6 additions and 10 deletions.
  1. +6 −10 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) {

0 comments on commit 614b2c5

Please sign in to comment.
You can’t perform that action at this time.