MCPcopy Create free account
hub / github.com/google/gapid / printFunc

Function printFunc

core/data/generic/generic.go:234–263  ·  view source on GitHub ↗
(f reflect.Type, fisrtParm int)

Source from the content-addressed store, hash-verified

232}
233
234func printFunc(f reflect.Type, fisrtParm int) string {
235 if f.Kind() != reflect.Func {
236 return "Not a function"
237 }
238 b := bytes.Buffer{}
239 b.WriteString("func(")
240 for i := fisrtParm; i < f.NumIn(); i++ {
241 if i > fisrtParm {
242 b.WriteString(", ")
243 }
244 b.WriteString(f.In(i).String())
245 }
246 b.WriteString(")")
247 switch f.NumOut() {
248 case 0:
249 case 1:
250 b.WriteString(" ")
251 b.WriteString(f.Out(0).String())
252 default:
253 b.WriteString(" (")
254 for i := 0; i < f.NumOut(); i++ {
255 if i > 0 {
256 b.WriteString(", ")
257 }
258 b.WriteString(f.Out(i).String())
259 }
260 b.WriteString(")")
261 }
262 return b.String()
263}

Callers 1

checkMethodFunction · 0.85

Calls 4

WriteStringMethod · 0.80
InMethod · 0.80
KindMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected