go/printer: refine handling of one-line functions
Functions that "fit" on one line and were on one
line in the original source are not broken up into
two lines anymore simply because they contain a comment.
- Fine-tuned use of separating blanks after /*-style comments, so:
( /* extra blank after this comment */ )
(a int /* no extra blank after this comment*/)
- Factored out comment state (from printer state) into commentInfo.
- No impact on $GOROOT/src, misc formatting.
Fixes issue 5543.
10 years, 1 month ago
(2014-02-26 19:55:37 UTC)
#3
https://codereview.appspot.com/68630043/diff/320001/src/pkg/go/printer/printe...
File src/pkg/go/printer/printer.go (right):
https://codereview.appspot.com/68630043/diff/320001/src/pkg/go/printer/printe...
src/pkg/go/printer/printer.go:42: noExtraBlank pmode = 1 << iota // disables
extra blank after /*-style comment
On 2014/02/26 19:41:26, r wrote:
> can these not be negative true?
I'd rather not in this case:
The normal case is an extra blank/line break. If I make them positive, then a)
the printer mode's default value is not the respective zero value anymore and
must be explicitly set (not too bad), and b) the place where this flag is used
is going to be using, say: enableExtraBlank to _disable_ the extra blank
(because the flag is toggled) - which is even more confusing.
I'm aware this is not optimal but I'd rather not fiddle with the flag mechanism
at this point.
*** Submitted as https://code.google.com/p/go/source/detail?r=b7298e3e7773 *** go/printer: refine handling of one-line functions Functions that "fit" on ...
10 years, 1 month ago
(2014-02-26 21:40:01 UTC)
#5
*** Submitted as https://code.google.com/p/go/source/detail?r=b7298e3e7773 ***
go/printer: refine handling of one-line functions
Functions that "fit" on one line and were on one
line in the original source are not broken up into
two lines anymore simply because they contain a comment.
- Fine-tuned use of separating blanks after /*-style comments, so:
( /* extra blank after this comment */ )
(a int /* no extra blank after this comment*/)
- Factored out comment state (from printer state) into commentInfo.
- No impact on $GOROOT/src, misc formatting.
Fixes issue 5543.
LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://codereview.appspot.com/68630043
Issue 68630043: code review 68630043: go/printer: refine handling of one-line functions
(Closed)
Created 10 years, 2 months ago by gri
Modified 10 years, 1 month ago
Reviewers: gobot
Base URL:
Comments: 3