internal/gen: doc exported symbols (#9)

This commit is contained in:
Michael McLoughlin
2019-01-05 14:12:50 -08:00
parent c3a3000908
commit cf1739b920
7 changed files with 27 additions and 0 deletions

View File

@@ -7,16 +7,20 @@ import (
"github.com/mmcloughlin/avo/printer"
)
// Interface of an instruction code generator.
type Interface interface {
Generate([]inst.Instruction) ([]byte, error)
}
// Func adapts a function to Interface.
type Func func([]inst.Instruction) ([]byte, error)
// Generate calls f.
func (f Func) Generate(is []inst.Instruction) ([]byte, error) {
return f(is)
}
// Builder constructs a code generator.
type Builder func(printer.Config) Interface
// GoFmt formats Go code produced from the given generator.