mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: fix import alias handling
This commit is contained in:
parent
f454112845
commit
8f8c7d2839
3 changed files with 24 additions and 3 deletions
|
@ -246,7 +246,11 @@ func (c *codegen) analyzeFuncUsage() funcUsage {
|
|||
case *ast.CallExpr:
|
||||
switch t := n.Fun.(type) {
|
||||
case *ast.Ident:
|
||||
usage[c.getIdentName("", t.Name)] = true
|
||||
var pkgPath string
|
||||
if !isMain {
|
||||
pkgPath = pkg.Path()
|
||||
}
|
||||
usage[c.getIdentName(pkgPath, t.Name)] = true
|
||||
case *ast.SelectorExpr:
|
||||
name, _ := c.getFuncNameFromSelector(t)
|
||||
usage[name] = true
|
||||
|
@ -254,7 +258,7 @@ func (c *codegen) analyzeFuncUsage() funcUsage {
|
|||
case *ast.FuncDecl:
|
||||
// exported functions are always assumed to be used
|
||||
if isMain && n.Name.IsExported() {
|
||||
usage[c.getFuncNameFromDecl(pkg.Path(), n)] = true
|
||||
usage[c.getFuncNameFromDecl("", n)] = true
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue