gotypes,build: pointer dereference (#61)

Provides a method on `gotypes.Component` to allow pointer dereference. This will enable `gotypes` helpers to be used with struct pointer arguments, for example.

Updates #53 
Fixes #54
This commit is contained in:
Michael McLoughlin
2019-01-27 19:22:21 -08:00
committed by GitHub
parent eb225e9d2c
commit 9eb409b935
9 changed files with 137 additions and 29 deletions

View File

@@ -7,6 +7,8 @@ import (
"go/token"
"go/types"
"strconv"
"github.com/mmcloughlin/avo/operand"
)
// Signature represents a Go function signature.
@@ -136,7 +138,8 @@ func newTuple(t *types.Tuple, offsets []int64, size int64, defaultprefix string)
name += strconv.Itoa(i)
}
}
c := NewComponent(name, v.Type(), int(offsets[i]))
addr := operand.NewParamAddr(name, int(offsets[i]))
c := NewComponent(v.Type(), addr)
tuple.components = append(tuple.components, c)
if v.Name() != "" {
tuple.byname[v.Name()] = c