test asmtest with instruction list
This commit is contained in:
@@ -20,10 +20,10 @@ func NewAsmTest(cfg Config) Interface {
|
||||
return &asmtest{cfg: cfg}
|
||||
}
|
||||
|
||||
func (a *asmtest) Generate(is []*inst.Instruction) ([]byte, error) {
|
||||
func (a *asmtest) Generate(is []inst.Instruction) ([]byte, error) {
|
||||
p := &printer{}
|
||||
|
||||
p.Printf("# %s\n\n", a.cfg.GeneratedWarning())
|
||||
p.Printf("// %s\n\n", a.cfg.GeneratedWarning())
|
||||
|
||||
a.sym = "\u00b7loadertest(SB)"
|
||||
p.Printf("TEXT %s, 0, $0\n", a.sym)
|
||||
|
||||
@@ -10,12 +10,12 @@ import (
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Generate([]*inst.Instruction) ([]byte, error)
|
||||
Generate([]inst.Instruction) ([]byte, error)
|
||||
}
|
||||
|
||||
type Func func([]*inst.Instruction) ([]byte, error)
|
||||
type Func func([]inst.Instruction) ([]byte, error)
|
||||
|
||||
func (f Func) Generate(is []*inst.Instruction) ([]byte, error) {
|
||||
func (f Func) Generate(is []inst.Instruction) ([]byte, error) {
|
||||
return f(is)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ type Builder func(Config) Interface
|
||||
|
||||
// GoFmt formats Go code produced from the given generator.
|
||||
func GoFmt(i Interface) Interface {
|
||||
return Func(func(is []*inst.Instruction) ([]byte, error) {
|
||||
return Func(func(is []inst.Instruction) ([]byte, error) {
|
||||
b, err := i.Generate(is)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -12,7 +12,7 @@ func NewGoData(cfg Config) Interface {
|
||||
return GoFmt(godata{cfg: cfg})
|
||||
}
|
||||
|
||||
func (g godata) Generate(is []*inst.Instruction) ([]byte, error) {
|
||||
func (g godata) Generate(is []inst.Instruction) ([]byte, error) {
|
||||
p := &printer{}
|
||||
|
||||
p.Printf("// %s\n\n", g.cfg.GeneratedWarning())
|
||||
|
||||
Reference in New Issue
Block a user