Skip to content

Commit

Permalink
refactor: remove type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
xtuc committed May 9, 2018
1 parent d72f7c6 commit 8bdc8ad
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/wasm/WebAssemblyParser.js
Expand Up @@ -45,27 +45,24 @@ class WebAssemblyParser extends Tapable {
const exports = (state.module.buildMeta.providedExports = []);
t.traverse(ast, {
ModuleExport({ node }) {
const moduleExport = /** @type {t.ModuleExport} */ (node);
exports.push(moduleExport.name);
exports.push(node.name);
},

ModuleImport({ node }) {
const moduleImport = /** @type {t.ModuleImport} */ (node);

let onlyDirectImport = false;

if (isMemoryImport(moduleImport) === true) {
if (isMemoryImport(node) === true) {
onlyDirectImport = true;
}

if (isTableImport(moduleImport) === true) {
if (isTableImport(node) === true) {
onlyDirectImport = true;
}

const dep = new WebAssemblyImportDependency(
moduleImport.module,
moduleImport.name,
moduleImport.descr,
node.module,
node.name,
node.descr,
onlyDirectImport
);

Expand Down

0 comments on commit 8bdc8ad

Please sign in to comment.