mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 09:02:28 +00:00
compiler: use fully-qualified names for tracking functions
Function name now consists of 3 parts: 1) full package path 2) method receiver type (if any) 3) function name itself . Fix #1150. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
528c184f00
commit
a781d299e0
8 changed files with 87 additions and 15 deletions
|
@ -113,14 +113,15 @@ func (c *codegen) analyzeFuncUsage() funcUsage {
|
|||
case *ast.CallExpr:
|
||||
switch t := n.Fun.(type) {
|
||||
case *ast.Ident:
|
||||
usage[t.Name] = true
|
||||
usage[c.getIdentName("", t.Name)] = true
|
||||
case *ast.SelectorExpr:
|
||||
usage[t.Sel.Name] = true
|
||||
name, _ := c.getFuncNameFromSelector(t)
|
||||
usage[name] = true
|
||||
}
|
||||
case *ast.FuncDecl:
|
||||
// exported functions are always assumed to be used
|
||||
if isMain && n.Name.IsExported() {
|
||||
usage[n.Name.Name] = true
|
||||
usage[c.getFuncNameFromDecl(pkg.Path(), n)] = true
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue