1
0
mirror of https://github.com/golang/go synced 2024-11-25 05:57:57 -07:00

reflect: trivial addition: Value.NumMethod.

Just an oversight it was missing.

R=rsc, dsymonds, bradfitz, r
CC=golang-dev
https://golang.org/cl/4695059
This commit is contained in:
Rob Pike 2011-07-14 10:38:15 +10:00
parent 0bf36ce8fb
commit 125e8277d5

View File

@ -1025,6 +1025,15 @@ func (v Value) Method(i int) Value {
return Value{v.Internal, i + 1}
}
// NumMethod returns the number of methods in the value's method set.
func (v Value) NumMethod() int {
iv := v.internal()
if iv.kind == Invalid {
panic(&ValueError{"reflect.Value.NumMethod", Invalid})
}
return iv.typ.NumMethod()
}
// MethodByName returns a function value corresponding to the method
// of v with the given name.
// The arguments to a Call on the returned function should not include