rpc: simplify suitableCallbacks

This commit is contained in:
Delweng Zheng 2018-11-11 15:53:35 +08:00
parent 1ff152f3a4
commit 1af79d14dd

View file

@ -133,30 +133,22 @@ METHODS:
firstArg = 2 firstArg = 2
} }
if h.isSubscribe {
h.argTypes = make([]reflect.Type, numIn-firstArg) // skip rcvr type
for i := firstArg; i < numIn; i++ {
argType := mtype.In(i)
if isExportedOrBuiltinType(argType) {
h.argTypes[i-firstArg] = argType
} else {
continue METHODS
}
}
subscriptions[mname] = &h
continue METHODS
}
// determine method arguments, ignore first arg since it's the receiver type // determine method arguments, ignore first arg since it's the receiver type
// Arguments must be exported or builtin types
h.argTypes = make([]reflect.Type, numIn-firstArg) h.argTypes = make([]reflect.Type, numIn-firstArg)
for i := firstArg; i < numIn; i++ { for i := firstArg; i < numIn; i++ {
argType := mtype.In(i) argType := mtype.In(i)
if !isExportedOrBuiltinType(argType) {
// Arguments must be exported or builtin types
if isExportedOrBuiltinType(argType) {
h.argTypes[i-firstArg] = argType
} else {
continue METHODS continue METHODS
} }
h.argTypes[i-firstArg] = argType }
if h.isSubscribe {
subscriptions[mname] = &h
continue METHODS
} }
// check that all returned values are exported or builtin types // check that all returned values are exported or builtin types