mirror of
https://github.com/golang/go
synced 2024-11-19 16:04:48 -07:00
cmd/compile: skip compiling wrappers for imported defined types
When compiling a package that defines a type T with method T.M, we already compile and emit the wrapper method (*T).M. There's no need for every package that uses T to do the same. Change-Id: I3ca2659029907570f8b98d66111686435fad7ed0 Reviewed-on: https://go-review.googlesource.com/74412 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
84e91e1d6b
commit
03c8c56682
@ -1659,6 +1659,12 @@ func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym, iface
|
|||||||
fmt.Printf("genwrapper rcvrtype=%v method=%v newnam=%v\n", rcvr, method, newnam)
|
fmt.Printf("genwrapper rcvrtype=%v method=%v newnam=%v\n", rcvr, method, newnam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only generate (*T).M wrappers for T.M in T's own package.
|
||||||
|
if rcvr.IsPtr() && rcvr.Elem() == method.Type.Recv().Type &&
|
||||||
|
rcvr.Elem().Sym != nil && rcvr.Elem().Sym.Pkg != localpkg {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
lineno = autogeneratedPos
|
lineno = autogeneratedPos
|
||||||
|
|
||||||
dclcontext = PEXTERN
|
dclcontext = PEXTERN
|
||||||
|
Loading…
Reference in New Issue
Block a user