diff options
author | Matthew Dempsky <mdempsky@google.com> | 2016-08-16 11:27:55 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2016-08-16 14:32:09 -0700 |
commit | 7a8201b92470c729e4e30fd22d16dca600ec9b7e (patch) | |
tree | 4c95739fe9f63febf81d4dad3d0b15e55fbae447 | |
parent | 38d52ef0c49035d00d753f9fe192c4f66f3f8ccc (diff) | |
download | go-7a8201b92470c729e4e30fd22d16dca600ec9b7e.tar.gz go-7a8201b92470c729e4e30fd22d16dca600ec9b7e.zip |
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.
-rw-r--r-- | src/cmd/compile/internal/syntax/syntax.go | 2 |
1 files changed, 1 insertions, 1 deletions
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) } |