ing
This commit is contained in:
parent
558c2aba94
commit
7dfdba6cf7
|
@ -101,7 +101,8 @@ func (rr *restRegistry) Invoke(method string, params []string, leadingParams ...
|
|||
|
||||
var in []reflect.Value
|
||||
pValues, pInstances := methodSpec.ParamValues()
|
||||
var lParamLen int
|
||||
|
||||
lParamLen := 0
|
||||
if nil != leadingParams {
|
||||
lParamLen = len(leadingParams)
|
||||
}
|
||||
|
@ -111,22 +112,10 @@ func (rr *restRegistry) Invoke(method string, params []string, leadingParams ...
|
|||
return nil, err
|
||||
}
|
||||
|
||||
for indexI := 0; indexI < lParamLen; indexI++ {
|
||||
i := pInstances[indexI]
|
||||
rv := reflect.ValueOf(i)
|
||||
iv := reflect.ValueOf(leadingParams[indexI])
|
||||
switch reflect.TypeOf(i).Elem().Kind() {
|
||||
case reflect.Struct:
|
||||
rv.Elem().Set(iv.Elem())
|
||||
default:
|
||||
rv.Elem().Set(iv)
|
||||
}
|
||||
}
|
||||
|
||||
pCount := len(pInstances)
|
||||
in = make([]reflect.Value, pCount+1)
|
||||
|
||||
for indexI := 0; indexI < pCount; indexI++ {
|
||||
for indexI := lParamLen; indexI < pCount; indexI++ {
|
||||
if pValues[indexI].Type().Kind() == reflect.Ptr && pValues[indexI].Type().Elem().Kind() != reflect.Struct {
|
||||
in[indexI+1] = reflect.Indirect(pValues[indexI])
|
||||
} else {
|
||||
|
@ -138,6 +127,10 @@ func (rr *restRegistry) Invoke(method string, params []string, leadingParams ...
|
|||
}
|
||||
in[0] = serviceSpec.ReceiverValue()
|
||||
|
||||
for indexI := 0; indexI < lParamLen; indexI++ {
|
||||
in[indexI+1] = reflect.ValueOf(leadingParams[indexI])
|
||||
}
|
||||
|
||||
// Call the service method.
|
||||
returnValues := methodSpec.Call(in)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user