compiler: properly inline methods, use receiver
Notice that this doesn't differentiate between (*T) and (T) receivers always treating them as is. But we have the same problem with arguments now and the number of inlined calls is limited, usually we want this behavior.
This commit is contained in:
parent
6014dd720f
commit
b57dd2cad6
3 changed files with 38 additions and 0 deletions
10
pkg/compiler/testdata/inline/inline.go
vendored
10
pkg/compiler/testdata/inline/inline.go
vendored
|
@ -46,3 +46,13 @@ func SumVar(a, b int) int {
|
|||
func Concat(n int) int {
|
||||
return n*100 + b.A*10 + A
|
||||
}
|
||||
|
||||
type T struct {
|
||||
N int
|
||||
}
|
||||
|
||||
func (t *T) Inc(i int) int {
|
||||
n := t.N
|
||||
t.N += i
|
||||
return n
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue