Commit 03c8c566 authored by Matthew Dempsky's avatar Matthew Dempsky

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: default avatarDavid Crawshaw <crawshaw@golang.org>
parent 84e91e1d
...@@ -1659,6 +1659,12 @@ func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym, iface ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment