start at some basic passes

This commit is contained in:
Michael McLoughlin
2018-12-02 12:28:33 -08:00
parent 0ceb1c55a4
commit 43575d8b61
14 changed files with 7209 additions and 3904 deletions

17
pass/pass.go Normal file
View File

@@ -0,0 +1,17 @@
package pass
import "github.com/mmcloughlin/avo"
// TODO(mbm): pass types
// FunctionPass builds a full pass that operates on all functions independently.
func FunctionPass(p func(*avo.Function) error) func(*avo.File) error {
return func(f *avo.File) error {
for _, fn := range f.Functions {
if err := p(fn); err != nil {
return err
}
}
return nil
}
}