MCPcopy Create free account
hub / github.com/nsf/gocode / method_of

Function method_of

decl.go:340–360  ·  view source on GitHub ↗
(d ast.Decl)

Source from the content-addressed store, hash-verified

338}
339
340func method_of(d ast.Decl) string {
341 if t, ok := d.(*ast.FuncDecl); ok {
342 if t.Recv != nil && len(t.Recv.List) != 0 {
343 switch t := t.Recv.List[0].Type.(type) {
344 case *ast.StarExpr:
345 if se, ok := t.X.(*ast.SelectorExpr); ok {
346 return se.Sel.Name
347 }
348 if ident, ok := t.X.(*ast.Ident); ok {
349 return ident.Name
350 }
351 return ""
352 case *ast.Ident:
353 return t.Name
354 default:
355 return ""
356 }
357 }
358 }
359 return ""
360}
361
362func (other *decl) deep_copy() *decl {
363 d := new(decl)

Callers 2

add_ast_decl_to_packageFunction · 0.85
append_to_top_declsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected