build: return ErrorList type

Adds a very similar interface to go/scanner package for returning a list
of errors.

Updates #34
This commit is contained in:
Michael McLoughlin
2019-01-06 13:32:09 -08:00
parent b6576feee6
commit 07901bb91b
4 changed files with 80 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ package pass_test
import (
"testing"
"github.com/mmcloughlin/avo/internal/test"
"github.com/mmcloughlin/avo/reg"
"github.com/mmcloughlin/avo/pass"
@@ -57,11 +58,9 @@ func AssertRegistersMatchSet(t *testing.T, rs []reg.Register, s reg.Set) {
}
func ConstructLiveness(t *testing.T, ctx *build.Context) *avo.Function {
f, errs := ctx.Result()
if errs != nil {
for _, err := range errs {
t.Error(err)
}
f, err := ctx.Result()
if err != nil {
build.LogError(test.Logger(t), err, 0)
t.FailNow()
}