MCPcopy
hub / github.com/tinylib/msgp / methodReceiver

Function methodReceiver

gen/spec.go:345–362  ·  view source on GitHub ↗

if necessary, wraps a type so that its method receiver is of the write type.

(p Elem)

Source from the content-addressed store, hash-verified

343// so that its method receiver
344// is of the write type.
345func methodReceiver(p Elem) string {
346 typeName := p.BaseTypeName()
347 typeParams := p.TypeParams()
348
349 switch p.(type) {
350
351 // structs and arrays are
352 // dereferenced automatically,
353 // so no need to alter varname
354 case *Struct, *Array:
355 return "*" + typeName + typeParams.TypeParams
356 // set variable name to
357 // *varname
358 default:
359 p.SetVarname("(*" + p.Varname() + ")")
360 return "*" + typeName + typeParams.TypeParams
361 }
362}
363
364func unsetReceiver(p Elem) {
365 switch p.(type) {

Callers 5

ExecuteMethod · 0.85
ExecuteMethod · 0.85
ExecuteMethod · 0.85
ExecuteMethod · 0.85
ExecuteMethod · 0.85

Calls 4

BaseTypeNameMethod · 0.65
TypeParamsMethod · 0.65
SetVarnameMethod · 0.65
VarnameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…