Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Declarations ¶
Declarations takes in a list of a declarations and a predicate that takes in one declaration and returns a boolean. Only the declarations for which `predicate` returns true will be included in the returned list of declarations.
For example, the following returns a list of only function declarations.
filters.Declarations(tree.Decls, func(decl ast.Decl) bool { _, ok := decl.(*ast.FuncDecl) return ok })
The order of declarations is maintained.
func FunctionsOnly ¶
FunctionsOnly returns a list of only the most outer function declarations present within the provided list. This filter does NOT recurse into those function declarations to find lambdas. For example, the following file...
func hi() bool { return func() bool { return true }() } func hello() bool { return false }
...will return the hi and hello functions but not the inner lambda within hi.
Types ¶
This section is empty.