From 7a8201b92470c729e4e30fd22d16dca600ec9b7e Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Tue, 16 Aug 2016 11:27:55 -0700 Subject: cmd/compile/internal/syntax: change Read to still return the AST If we the caller provided an error handler, still return our best effort parsed AST tree. --- src/cmd/compile/internal/syntax/syntax.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/syntax/syntax.go b/src/cmd/compile/internal/syntax/syntax.go index 71990bca8b..85dddaa47f 100644 --- a/src/cmd/compile/internal/syntax/syntax.go +++ b/src/cmd/compile/internal/syntax/syntax.go @@ -49,7 +49,7 @@ func Read(src io.Reader, errh ErrorHandler, mode Mode) (*File, error) { p.next() ast := p.file() - if p.nerrors > 0 { + if errh == nil && p.nerrors > 0 { return nil, fmt.Errorf("%d syntax errors", p.nerrors) } -- cgit v1.2.3-54-g00ecf