forked from blek/bshchk
1
0
Fork 0

ignore function names

This commit is contained in:
b1ek 2024-06-07 22:25:37 +10:00
parent c777bd25b0
commit dba8899100
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 12 additions and 0 deletions

View File

@ -34,6 +34,18 @@ func find(code string) ([]string, error) {
} }
ignored, deps := get_ignored_and_deps(code) ignored, deps := get_ignored_and_deps(code)
// 1. find function declarations
syntax.Walk(f, func(node syntax.Node) bool {
switch x := node.(type) {
case *syntax.FuncDecl:
ignored = append(ignored, x.Name.Value)
}
return true
})
// 2. collect all commands
syntax.Walk(f, func(node syntax.Node) bool { syntax.Walk(f, func(node syntax.Node) bool {
switch x := node.(type) { switch x := node.(type) {
case *syntax.CallExpr: case *syntax.CallExpr: