mirror of https://github.com/golang/go.git
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:
parent
38d52ef0c4
commit
7a8201b924
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue