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

Function embedded

parse/getast.go:649–661  ·  view source on GitHub ↗

extract embedded field name so, for a struct like type A struct { io.Writer } we want "Writer"

(f ast.Expr)

Source from the content-addressed store, hash-verified

647//
648// we want "Writer"
649func embedded(f ast.Expr) string {
650 switch f := f.(type) {
651 case *ast.Ident:
652 return f.Name
653 case *ast.StarExpr:
654 return embedded(f.X)
655 case *ast.SelectorExpr:
656 return f.Sel.Name
657 default:
658 // other possibilities are disallowed
659 return ""
660 }
661}
662
663// stringify a field type name
664func stringify(e ast.Expr) string {

Callers 1

getFieldMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…