printing: commit some refactors (probably broken)
This commit is contained in:
23
printer/stubs.go
Normal file
23
printer/stubs.go
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user