33 lines
550 B
Go
33 lines
550 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"go/ast"
|
|
)
|
|
|
|
func parseFuncDecl(loc string, d *ast.FuncDecl) {
|
|
loc += "." + d.Name.String()
|
|
// fmt.Printf("%s()\n", loc)
|
|
if d.Body == nil {
|
|
fmt.Println("nil func body")
|
|
return
|
|
}
|
|
for _, s := range d.Body.List {
|
|
parseStmt(loc, s)
|
|
}
|
|
}
|
|
|
|
func parseGenDecl(loc string, d *ast.GenDecl) {
|
|
loc += "/gendecl"
|
|
for _, s := range d.Specs {
|
|
switch s := s.(type) {
|
|
case *ast.TypeSpec:
|
|
parseTypeSpec(loc, s)
|
|
case *ast.ImportSpec, *ast.ValueSpec:
|
|
// rien
|
|
default:
|
|
fmt.Printf("%s/(%T)\n", loc, s)
|
|
}
|
|
|
|
}
|
|
}
|