internal/lib/reflect: Value.Type

This commit is contained in:
visualfc
2024-10-11 09:02:09 +08:00
parent d946ba426e
commit 515057c41a
3 changed files with 3897 additions and 3631 deletions

View File

@@ -553,6 +553,22 @@ func (t *Type) InterfaceType() *InterfaceType {
return (*InterfaceType)(unsafe.Pointer(t))
}
func (t *Type) ExportedMethods() []Method {
ut := t.Uncommon()
if ut == nil {
return nil
}
return ut.ExportedMethods()
}
func (t *Type) NumMethod() int {
if t.Kind() == Interface {
tt := (*InterfaceType)(unsafe.Pointer(t))
return tt.NumMethod()
}
return len(t.ExportedMethods())
}
// -----------------------------------------------------------------------------
// addChecked returns p+x.