mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: test name data is aligned
For #14962. Change-Id: I3539d882487c99dee99ac953e039b79c6b963cf9 Reviewed-on: https://go-review.googlesource.com/21150 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
edb19aa1cd
commit
640164bc1c
2 changed files with 37 additions and 0 deletions
|
|
@ -70,3 +70,27 @@ func CachedBucketOf(m Type) Type {
|
|||
tt := (*mapType)(unsafe.Pointer(t))
|
||||
return tt.bucket
|
||||
}
|
||||
|
||||
type EmbedWithUnexpMeth struct{}
|
||||
|
||||
func (EmbedWithUnexpMeth) f() {}
|
||||
|
||||
type pinUnexpMeth interface {
|
||||
f()
|
||||
}
|
||||
|
||||
var pinUnexpMethI = pinUnexpMeth(EmbedWithUnexpMeth{})
|
||||
|
||||
func FirstMethodNameBytes(t Type) *byte {
|
||||
_ = pinUnexpMethI
|
||||
|
||||
ut := t.uncommon()
|
||||
if ut == nil {
|
||||
panic("type has no methods")
|
||||
}
|
||||
m := ut.methods[0]
|
||||
if *m.name.data(0)&(1<<2) == 0 {
|
||||
panic("method name does not have pkgPath *string")
|
||||
}
|
||||
return m.name.bytes
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue