Skip to content

Commit

Permalink
parser: handle method attached to pointer type
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Jul 29, 2024
1 parent ea9fb33 commit 789aa89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions internal/gno/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ func typeFromNode(x ast.Node, source string) (string, []Symbol) {
switch x := x.(type) {
case *ast.Ident:
return x.Name, nil
case *ast.StarExpr:
return typeFromNode(x.X, source)
case *ast.ValueSpec:
if x.Type != nil {
return typeFromNode(x.Type, source)
Expand Down
4 changes: 2 additions & 2 deletions internal/gno/testdata/parsePackages-variable.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type MyType struct {

func (MyType) F(int) bool { return false }

func (otherType) f(int) bool { return false }
func (o *otherType) f(int) bool { return false }

type otherType struct {
X int
Expand Down Expand Up @@ -89,7 +89,7 @@ func Hello() {
},
{
"Name": "f",
"Signature": "func (otherType) f(int) bool",
"Signature": "func (o *otherType) f(int) bool",
"Kind": "method",
"Recv": "otherType"
}
Expand Down

0 comments on commit 789aa89

Please sign in to comment.