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.
This commit is contained in:
Matthew Dempsky 2016-08-16 11:27:55 -07:00
parent 38d52ef0c4
commit 7a8201b924
1 changed files with 1 additions and 1 deletions

View File

@ -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)
}