MCPcopy Index your code
hub / github.com/expr-lang/expr / IsFastFunc

Function IsFastFunc

checker/info.go:104–125  ·  view source on GitHub ↗
(fn reflect.Type, method bool)

Source from the content-addressed store, hash-verified

102}
103
104func IsFastFunc(fn reflect.Type, method bool) bool {
105 if fn == nil {
106 return false
107 }
108 if fn.Kind() != reflect.Func {
109 return false
110 }
111 numIn := 1
112 if method {
113 numIn = 2
114 }
115 if fn.IsVariadic() &&
116 fn.NumIn() == numIn &&
117 fn.NumOut() == 1 &&
118 fn.Out(0).Kind() == reflect.Interface {
119 rest := fn.In(fn.NumIn() - 1) // function has only one param for functions and two for methods
120 if rest != nil && rest.Kind() == reflect.Slice && rest.Elem().Kind() == reflect.Interface {
121 return true
122 }
123 }
124 return false
125}

Callers 1

CallNodeMethod · 0.92

Calls 6

IsVariadicMethod · 0.80
NumInMethod · 0.80
NumOutMethod · 0.80
OutMethod · 0.80
InMethod · 0.80
ElemMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…