Do not bind alias definitions
@@ -167,14 +167,24 @@ func (b *binder) bindPackageDeclarations(pkg *symbols.Package) {
}
}
+func isModuleAlias(pkg *symbols.Package, mod tokens.ModuleName) bool {
+ if pkg.Node.Aliases == nil {
+ return false
+ }
+ _, isalias := (*pkg.Node.Aliases)[mod]
+ return isalias
+}
+
// bindPackageExports resolves exports to their referent symbols, one level deep. During this phase, exports may depend
// upon other exports, and so until it has settled, we can't properly chase down export links.
func (b *binder) bindPackageExports(pkg *symbols.Package) {
contract.Require(pkg != nil, "pkg")
for _, mod := range symbols.StableModuleMap(pkg.Modules) {
+ if !isModuleAlias(pkg, mod) {
b.bindModuleExports(pkg.Modules[mod])
}
}
+}
// bindPackageDefinitions binds all definitions within a package (classes, signatures, varaibles, etc), but doesn't
// actually bind any function bodies yet. The function bodies may depend upon information that depends upon information
@@ -182,14 +192,18 @@ func (b *binder) bindPackageExports(pkg *symbols.Package) {
func (b *binder) bindPackageDefinitions(pkg *symbols.Package) {
contract.Require(pkg != nil, "pkg")
for _, mod := range symbols.StableModuleMap(pkg.Modules) {
+ if !isModuleAlias(pkg, mod) {
b.bindModuleDefinitions(pkg.Modules[mod])
}
}
+}
// bindPackageBodies binds all method bodies, in a distinct pass, after binding all symbol-level information.
func (b *binder) bindPackageBodies(pkg *symbols.Package) {
contract.Require(pkg != nil, "pkg")
for _, mod := range symbols.StableModuleMap(pkg.Modules) {
+ if !isModuleAlias(pkg, mod) {
b.bindModuleBodies(pkg.Modules[mod])
}
}
+}
