aboutsummaryrefslogtreecommitdiff
path: root/src/reflect/export_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/reflect/export_test.go')
-rw-r--r--src/reflect/export_test.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/reflect/export_test.go b/src/reflect/export_test.go
index ddc64b46be..00189f3353 100644
--- a/src/reflect/export_test.go
+++ b/src/reflect/export_test.go
@@ -46,9 +46,12 @@ func FuncLayout(t Type, rcvr Type) (frametype Type, argSize, retOffset uintptr,
func TypeLinks() []string {
var r []string
- for _, m := range typelinks() {
- for _, t := range m {
- r = append(r, t.string)
+ sections, offset := typelinks()
+ for i, offs := range offset {
+ rodata := sections[i]
+ for _, off := range offs {
+ typ := (*rtype)(resolveTypeOff(unsafe.Pointer(rodata), off))
+ r = append(r, typ.String())
}
}
return r
@@ -88,14 +91,21 @@ func FirstMethodNameBytes(t Type) *byte {
if ut == nil {
panic("type has no methods")
}
- m := ut.methods[0]
- if *m.name.data(0)&(1<<2) == 0 {
+ m := ut.methods()[0]
+ mname := t.(*rtype).nameOff(m.name)
+ if *mname.data(0)&(1<<2) == 0 {
panic("method name does not have pkgPath *string")
}
- return m.name.bytes
+ return mname.bytes
}
type OtherPkgFields struct {
OtherExported int
otherUnexported int
}
+
+func IsExported(t Type) bool {
+ typ := t.(*rtype)
+ n := typ.nameOff(typ.str)
+ return n.isExported()
+}