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

@@ -1525,7 +1525,6 @@ func (v Value) Type() Type {
}
func (v Value) typeSlow() Type {
/* TODO(xsw):
if v.flag == 0 {
panic(&ValueError{"reflect.Value.Type", Invalid})
}
@@ -1545,7 +1544,7 @@ func (v Value) typeSlow() Type {
panic("reflect: internal error: invalid method index")
}
m := &tt.Methods[i]
return toRType(typeOffFor(typ, m.Typ))
return toRType(&m.Typ_.Type)
}
// Method on concrete type.
ms := typ.ExportedMethods()
@@ -1553,9 +1552,7 @@ func (v Value) typeSlow() Type {
panic("reflect: internal error: invalid method index")
}
m := ms[i]
return toRType(typeOffFor(typ, m.Mtyp))
*/
panic("todo: reflect.Value.Type")
return toRType(&m.Mtyp_.Type)
}
// CanUint reports whether Uint can be used without panicking.