From 7a7c747c6f5f732d614cea2404386913e68981a0 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 23 Feb 2018 13:43:43 +0100 Subject: pkg/compiler: allow unions as syscall arguments If all union options can be syscall arguments, allow the union itself as syscall argument. --- pkg/ast/test_util.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg/ast') diff --git a/pkg/ast/test_util.go b/pkg/ast/test_util.go index b9fe12152..fbec645b7 100644 --- a/pkg/ast/test_util.go +++ b/pkg/ast/test_util.go @@ -8,6 +8,7 @@ import ( "bytes" "io/ioutil" "path/filepath" + "regexp" "strings" "testing" ) @@ -60,7 +61,12 @@ func NewErrorMatcher(t *testing.T, file string) *ErrorMatcher { } } +var errorLocationRe = regexp.MustCompile("at [a-z][a-z0-9]+\\.txt:[0-9]+:[0-9]+") + func (em *ErrorMatcher) ErrorHandler(pos Pos, msg string) { + if match := errorLocationRe.FindStringSubmatchIndex(msg); match != nil { + msg = msg[0:match[0]] + "at LOCATION" + msg[match[1]:] + } em.got = append(em.got, &errorDesc{ file: pos.File, line: pos.Line, -- cgit mrf-deployment