aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2016-08-16 11:27:55 -0700
committerMatthew Dempsky <mdempsky@google.com>2016-08-16 14:32:09 -0700
commit7a8201b92470c729e4e30fd22d16dca600ec9b7e (patch)
tree4c95739fe9f63febf81d4dad3d0b15e55fbae447
parent38d52ef0c49035d00d753f9fe192c4f66f3f8ccc (diff)
downloadgo-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.go2
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)
}