Commit f0964a54 authored by Russ Cox's avatar Russ Cox

go/printer: fix sync bug - avoid sending on errors twice -

	and report node type in error

R=gri
DELTA=4  (3 added, 0 deleted, 1 changed)
OCL=34949
CL=34955
parent b817e979
...@@ -14,6 +14,7 @@ import ( ...@@ -14,6 +14,7 @@ import (
"io"; "io";
"os"; "os";
"reflect"; "reflect";
"runtime";
"strings"; "strings";
"tabwriter"; "tabwriter";
) )
...@@ -105,6 +106,7 @@ func (p *printer) write0(data []byte) { ...@@ -105,6 +106,7 @@ func (p *printer) write0(data []byte) {
p.written += n; p.written += n;
if err != nil { if err != nil {
p.errors <- err; p.errors <- err;
runtime.Goexit();
} }
} }
...@@ -1402,7 +1404,8 @@ func Fprint(output io.Writer, node interface{}, mode uint, tabwidth int) (int, o ...@@ -1402,7 +1404,8 @@ func Fprint(output io.Writer, node interface{}, mode uint, tabwidth int) (int, o
p.comment = n.Comments; p.comment = n.Comments;
p.file(n); p.file(n);
default: default:
p.errors <- os.NewError("unsupported node type"); p.errors <- os.NewError(fmt.Sprintf("unsupported node type %T", n));
runtime.Goexit();
} }
p.flush(inf); p.flush(inf);
p.errors <- nil; // no errors p.errors <- nil; // no errors
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment