]> Cypherpunks repositories - gostls13.git/commit
go/printer, gofmt: don't print incorrect programs
authorRobert Griesemer <gri@golang.org>
Tue, 7 Feb 2012 23:19:52 +0000 (15:19 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 7 Feb 2012 23:19:52 +0000 (15:19 -0800)
commit3d6b368514f2b72538c23a27f248684dd9cca227
tree7c6b26f1c1b86046962aaca270c5a07d68cedb71
parente3755434b8790288a1d48ae3ebf9f4e49c881849
go/printer, gofmt: don't print incorrect programs

Be careful when printing line comments with incorrect
position information. Maintain additional state
impliedSemi: when set, a comment containing a newline
would imply a semicolon and thus placement must be
delayed.

Precompute state information pertaining to the next
comment for faster checks (the printer is marginally
faster now despite additional checks for each comment).

No effect on existing src, misc sources.

Fixes #1505.

R=rsc
CC=golang-dev
https://golang.org/cl/5598054
src/cmd/fix/timefileinfo_test.go
src/pkg/go/printer/nodes.go
src/pkg/go/printer/printer.go
src/pkg/go/printer/printer_test.go