1
0
mirror of https://github.com/golang/go synced 2024-10-05 21:21:21 -06:00
go/src/reflect
Michael Hudson-Doyle 2f0828ef7c reflect, cmd/internal/gc: look for pointer types by string before synthesizing
The ptrto field of the type data cannot be relied on when dynamic linking: a
type T may be defined in a module that makes no use of pointers to that type,
but another module can contain a package that imports the first one and does use
*T pointers.  The second module will end up defining type data for *T and a
type.*T symbol pointing at it. It's important that calling .PtrTo() on the
refect.Type for T returns this type data and not some synthesized object, so we
need reflect to be able to find it!

Fortunately, the reflect package already has a mechanism for doing this sort of
thing: ChanOf/MapOf/etc look for pre-existing type data by name.  So this change
just extends PtrTo() to consult this too, and changes the compiler to include
pointer types in the data consulted when compiling for dynamic linking.

Change-Id: I3773c066fd0679a62e9fc52a84bf64f1d67662b7
Reviewed-on: https://go-review.googlesource.com/8232
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-04-16 16:11:07 +00:00
..
all_test.go reflect: add FuncOf function 2015-04-16 01:38:50 +00:00
asm_386.s
asm_amd64.s
asm_amd64p32.s
asm_arm64.s reflect: add support for GOARCH=arm64 2015-03-16 18:46:27 +00:00
asm_arm.s
asm_ppc64x.s all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
deepequal.go
example_test.go reflect: document reflect.TypeOf((*Foo)(nil)).Elem() idiom 2015-04-14 17:19:36 +00:00
export_test.go reflect: add FuncOf function 2015-04-16 01:38:50 +00:00
makefunc.go reflect: cache call frames 2015-01-28 08:40:26 +00:00
set_test.go
tostring_test.go
type.go reflect, cmd/internal/gc: look for pointer types by string before synthesizing 2015-04-16 16:11:07 +00:00
value.go fmt: treat reflect.Value specially - as the value it holds 2015-04-15 15:59:39 +00:00