Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

cristaloleg/astp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASTP

Go AST predicates

func Walk(var node ast.Node) {
    switch {
    case astp.IsValueSpec(node):
        value := astp.AsValueSpec()

        for _, name := range value.Names {
            if name != nil {
                println("value name: " + name.Name)
            }
        }

    case astp.IsFuncDecl(node):
        fn := astp.AsFuncDecl()
        if fn.Name != nil {
            println("function: " + fn.Name.Name)
        }
    }
}

Releases

No releases published

Packages

No packages published

Languages