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

Method parse_method_decl

package_text.go:631–644  ·  view source on GitHub ↗

MethodDecl = "func" Receiver Name Signature . Receiver = "(" ( identifier | "?" ) [ "*" ] ExportedName ")" [ FuncBody ] .

()

Source from the content-addressed store, hash-verified

629// MethodDecl = "func" Receiver Name Signature .
630// Receiver = "(" ( identifier | "?" ) [ "*" ] ExportedName ")" [ FuncBody ] .
631func (p *gc_parser) parse_method_decl() (string, *ast.FuncDecl) {
632 recv := p.parse_parameters()
633 pkg := strip_method_receiver(recv)
634 name, _ := p.parse_name()
635 typ := p.parse_signature()
636 if p.tok == '{' {
637 p.parse_func_body()
638 }
639 return pkg, &ast.FuncDecl{
640 Recv: recv,
641 Name: ast.NewIdent(name),
642 Type: typ,
643 }
644}
645
646// Decl = [ ImportDecl | ConstDecl | TypeDecl | VarDecl | FuncDecl | MethodDecl ] "\n" .
647func (p *gc_parser) parse_decl() (pkg string, decl ast.Decl) {

Callers 1

parse_declMethod · 0.95

Calls 5

parse_parametersMethod · 0.95
parse_nameMethod · 0.95
parse_signatureMethod · 0.95
parse_func_bodyMethod · 0.95
strip_method_receiverFunction · 0.85

Tested by

no test coverage detected