MCPcopy
hub / github.com/cweill/gotests / parseFunctions

Method parseFunctions

internal/goparser/goparser.go:101–119  ·  view source on GitHub ↗
(fset *token.FileSet, f *ast.File, fs []*ast.File, src []byte)

Source from the content-addressed store, hash-verified

99}
100
101func (p *Parser) parseFunctions(fset *token.FileSet, f *ast.File, fs []*ast.File, src []byte) []*models.Function {
102 ul, el := p.parseTypes(fset, fs)
103 // Parse type declarations to extract type parameters
104 typeParams := p.parseTypeDecls(f, fs)
105 var funcs []*models.Function
106 for _, d := range f.Decls {
107 fDecl, ok := d.(*ast.FuncDecl)
108 if !ok {
109 continue
110 }
111 fn := parseFunc(fDecl, ul, el, typeParams)
112 // Extract function body source code for AI context
113 if fDecl.Body != nil {
114 fn.Body = extractFunctionBody(fset, fDecl, src)
115 }
116 funcs = append(funcs, fn)
117 }
118 return funcs
119}
120
121// parseTypeDecls extracts type parameters from type declarations
122// Returns a map from type name to its type parameters

Callers 1

ParseMethod · 0.95

Calls 4

parseTypesMethod · 0.95
parseTypeDeclsMethod · 0.95
parseFuncFunction · 0.85
extractFunctionBodyFunction · 0.85

Tested by

no test coverage detected