Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1362)

Issue 5598054: code review 5598054: go/printer, gofmt: don't print incorrect programs (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by gri
Modified:
12 years, 2 months ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

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 issue 1505.

Patch Set 1 #

Patch Set 2 : diff -r 0dbc9639d5a9 https://code.google.com/p/go #

Patch Set 3 : diff -r 389444436d35 https://code.google.com/p/go #

Patch Set 4 : diff -r 389444436d35 https://code.google.com/p/go #

Patch Set 5 : diff -r c90b59861968 https://code.google.com/p/go #

Patch Set 6 : diff -r e082f3f78ca1 https://code.google.com/p/go #

Patch Set 7 : diff -r e082f3f78ca1 https://code.google.com/p/go #

Patch Set 8 : diff -r bbc3f6917c2b https://code.google.com/p/go #

Patch Set 9 : diff -r bbc3f6917c2b https://code.google.com/p/go #

Patch Set 10 : diff -r 1feba777e93c https://code.google.com/p/go #

Patch Set 11 : diff -r fae148fab2a7 https://code.google.com/p/go #

Total comments: 8

Patch Set 12 : diff -r 915676d75024 https://code.google.com/p/go #

Patch Set 13 : diff -r 915676d75024 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -46 lines) Patch
M src/cmd/fix/timefileinfo_test.go View 1 2 3 4 1 chunk +26 lines, -0 lines 0 comments Download
M src/pkg/go/printer/nodes.go View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/go/printer/printer.go View 1 2 3 4 5 6 7 8 9 10 11 12 chunks +114 lines, -39 lines 0 comments Download
M src/pkg/go/printer/printer_test.go View 1 2 3 4 5 5 chunks +68 lines, -7 lines 0 comments Download

Messages

Total messages: 5
gri
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
12 years, 2 months ago (2012-02-07 01:41:36 UTC) #1
rsc
Looks good except for the note around printer.go:881. http://codereview.appspot.com/5598054/diff/19001/src/pkg/go/printer/printer.go File src/pkg/go/printer/printer.go (right): http://codereview.appspot.com/5598054/diff/19001/src/pkg/go/printer/printer.go#newcode109 src/pkg/go/printer/printer.go:109: if ...
12 years, 2 months ago (2012-02-07 22:56:41 UTC) #2
gri
PTAL http://codereview.appspot.com/5598054/diff/19001/src/pkg/go/printer/printer.go File src/pkg/go/printer/printer.go (right): http://codereview.appspot.com/5598054/diff/19001/src/pkg/go/printer/printer.go#newcode109 src/pkg/go/printer/printer.go:109: if len(text) >= 2 { // should always ...
12 years, 2 months ago (2012-02-07 23:13:16 UTC) #3
rsc
LGTM
12 years, 2 months ago (2012-02-07 23:17:29 UTC) #4
gri
12 years, 2 months ago (2012-02-07 23:19:56 UTC) #5
*** Submitted as 0ff7fac59df1 ***

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 issue 1505.

R=rsc
CC=golang-dev
http://codereview.appspot.com/5598054
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b