mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
dclcontext = PEXTERN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue