register named method id as a reference to avoid collisions - fixes #1664
This commit is contained in:
@@ -45,6 +45,7 @@ var wrap = function (state, method, id, scope) {
|
||||
}
|
||||
|
||||
method.id = id;
|
||||
scope.getProgramParent().references[id.name] = true;
|
||||
};
|
||||
|
||||
var visit = function (node, name, scope) {
|
||||
|
||||
@@ -70,6 +70,7 @@ export default class CommonJSFormatter extends DefaultFormatter {
|
||||
t.variableDeclarator(variableName, ref)
|
||||
]));
|
||||
} else {
|
||||
console.log(variableName.name);
|
||||
// import { foo } from "foo";
|
||||
this.internalRemap[variableName.name] = t.memberExpression(ref, specifier.imported);
|
||||
}
|
||||
|
||||
@@ -44,12 +44,6 @@ var collectorVisitor = {
|
||||
}
|
||||
},
|
||||
|
||||
Scopable(node, parent, scope) {
|
||||
for (var name in scope.bindings) {
|
||||
scope.getProgramParent().references[name] = true;
|
||||
}
|
||||
},
|
||||
|
||||
ExportDeclaration: {
|
||||
exit(node, parent, scope) {
|
||||
var declar = node.declaration;
|
||||
@@ -459,6 +453,7 @@ export default class Scope {
|
||||
return;
|
||||
}
|
||||
|
||||
var parent = this.getProgramParent();
|
||||
var ids = path.getBindingIdentifiers();
|
||||
|
||||
for (var name in ids) {
|
||||
@@ -470,6 +465,8 @@ export default class Scope {
|
||||
this.checkBlockScopedCollisions(local, kind, name, id);
|
||||
}
|
||||
|
||||
parent.references[name] = true;
|
||||
|
||||
this.bindings[name] = new Binding({
|
||||
identifier: id,
|
||||
scope: this,
|
||||
|
||||
Reference in New Issue
Block a user