mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
compiler: getFuncNameFromDecl for methods on pointers
Declaration has *ast.StarExpr type in case of method on pointer.
This commit is contained in:
parent
7560aa345a
commit
058da7c2bd
1 changed files with 6 additions and 1 deletions
|
@ -77,7 +77,12 @@ func (c *codegen) newFuncScope(decl *ast.FuncDecl, label uint16) *funcScope {
|
||||||
func (c *codegen) getFuncNameFromDecl(pkgPath string, decl *ast.FuncDecl) string {
|
func (c *codegen) getFuncNameFromDecl(pkgPath string, decl *ast.FuncDecl) string {
|
||||||
name := decl.Name.Name
|
name := decl.Name.Name
|
||||||
if decl.Recv != nil {
|
if decl.Recv != nil {
|
||||||
name = decl.Recv.List[0].Type.(*ast.Ident).Name + "." + name
|
switch t := decl.Recv.List[0].Type.(type) {
|
||||||
|
case *ast.Ident:
|
||||||
|
name = t.Name + "." + name
|
||||||
|
case *ast.StarExpr:
|
||||||
|
name = t.X.(*ast.Ident).Name + "." + name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return c.getIdentName(pkgPath, name)
|
return c.getIdentName(pkgPath, name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue