Skip to content

Commit

Permalink
note that the builder needs changings
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Dec 3, 2020
1 parent 8804cbb commit 6528a62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ module.exports = class Macros {

if (
this.builder.t.isCallExpression(expression) &&
this.localDebugBindings.some(b => b.get('imported').node.name === expression.callee.name)
this.localDebugBindings.some(b => b.get('local').node.name === expression.callee.name)
) {
let imported = path.scope.getBinding(expression.callee.name).path.node.imported.name;
// The builder needs to be made aware of the the local name of the ImportSpecifier
this.builder[`${imported}`](path);
}
}
Expand All @@ -62,12 +63,11 @@ module.exports = class Macros {
// import declaration in question seems to have already been removed
return;
}

let specifiers = importPath.get('specifiers');

if (specifiers.length === this.localDebugBindings.length) {
importPath.remove();
} else if (specifiers.length === 1) {
importPath.remove();
} else {
this.localDebugBindings.forEach(binding => binding.get('local').parentPath.remove());
}
Expand Down

0 comments on commit 6528a62

Please sign in to comment.