2017-08-27 17:46:04 +02:00
|
|
|
package methodfunc
|
|
|
|
|
|
|
|
import (
|
2017-09-15 14:05:35 +02:00
|
|
|
"reflect"
|
|
|
|
|
2017-08-27 17:46:04 +02:00
|
|
|
"github.com/kataras/iris/context"
|
|
|
|
)
|
|
|
|
|
2017-09-15 14:05:35 +02:00
|
|
|
// buildMethodCall builds the method caller.
|
|
|
|
// We have repeated code here but it's the only way
|
|
|
|
// to support more than one input arguments without performance cost compared to previous implementation.
|
|
|
|
// so it's hard-coded written to check the length of input args and their types.
|
|
|
|
func buildMethodCall(a *ast) func(ctx context.Context, f reflect.Value) {
|
2017-10-09 14:26:46 +02:00
|
|
|
// if func input arguments are more than one then
|
|
|
|
// use the Call method (slower).
|
2017-09-15 14:05:35 +02:00
|
|
|
return func(ctx context.Context, f reflect.Value) {
|
2017-10-09 14:26:46 +02:00
|
|
|
DispatchFuncResult(ctx, f.Call(a.paramValues(ctx)))
|
2017-08-27 17:46:04 +02:00
|
|
|
}
|
|
|
|
}
|