diff options
author | Robert Griesemer <gri@golang.org> | 2017-06-01 17:51:02 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2017-06-02 20:07:51 +0000 |
commit | a86362e07fb9e83f1ce15592764b4bb5751fe1e9 (patch) | |
tree | 80afc24ff2f6c6f208121bd99a3398be84514f87 /CONTRIBUTORS | |
parent | 29469d2406d213187ee91bd256bb60e98e451324 (diff) | |
download | go-a86362e07fb9e83f1ce15592764b4bb5751fe1e9.tar.gz go-a86362e07fb9e83f1ce15592764b4bb5751fe1e9.zip |
go/printer: don't emit unnecessary //line directives before empty lines
1) Split atLineBegin into its two components: writing of // line directives
and writing of indentation (no functionality changes).
2) Don't call writeLineDirective at the beginning of a line if we're
writing white space - it's not necessary. This is the bug fix.
3) Move testing of the SourcePos mode out of writeLineDirective and
into the (single) caller. Clearer and more efficient.
(Instead of these 3 changes one could also have simply called the
original atLineBegin with position p.out rather than p.pos. This
would have caused atLineBegin to not write a line directive.
Factoring the code seemed like a cleaner and more direct approach.)
Fixes #5945.
Change-Id: Ia8710806b6d3d4e5044116b142c036a4ab5a1764
Reviewed-on: https://go-review.googlesource.com/44651
Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'CONTRIBUTORS')
0 files changed, 0 insertions, 0 deletions