printing: commit some refactors (probably broken)

This commit is contained in:
Michael McLoughlin
2018-12-11 00:18:22 -08:00
parent 4dc909a81e
commit c882e52510
21 changed files with 398 additions and 222 deletions

23
printer/stubs.go Normal file
View File

@@ -0,0 +1,23 @@
package printer
import (
"github.com/mmcloughlin/avo"
"github.com/mmcloughlin/avo/internal/prnt"
)
type stubs struct {
cfg Config
prnt.Generator
}
func NewStubs(cfg Config) Printer {
return &stubs{cfg: cfg}
}
func (s *stubs) Print(f *avo.File) ([]byte, error) {
s.Printf("package %s\n\n", s.cfg.Pkg)
for _, fn := range f.Functions {
s.Printf("%s\n", fn.Stub())
}
return s.Result()
}