diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-03-30 22:09:55 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-03-30 22:09:55 +0000 |
commit | 9a18821cfc7169ea9f4d0bb661e7c4ea362e993d (patch) | |
tree | 26322d11da7cc220190e0b8430565ea207eb3eab /libgo/go/go/printer | |
parent | 57c7433fdc3fcb7b0cfd7b13bd11360a5e17c624 (diff) |
libgo: Update to weekly.2012-03-22.
From-SVN: r186026
Diffstat (limited to 'libgo/go/go/printer')
-rw-r--r-- | libgo/go/go/printer/nodes.go | 2 | ||||
-rw-r--r-- | libgo/go/go/printer/testdata/declarations.golden | 15 | ||||
-rw-r--r-- | libgo/go/go/printer/testdata/declarations.input | 10 |
3 files changed, 24 insertions, 3 deletions
diff --git a/libgo/go/go/printer/nodes.go b/libgo/go/go/printer/nodes.go index 6be3c09382e..727d2a37147 100644 --- a/libgo/go/go/printer/nodes.go +++ b/libgo/go/go/printer/nodes.go @@ -365,7 +365,7 @@ func (p *printer) setLineComment(text string) { } func (p *printer) isMultiLine(n ast.Node) bool { - return p.lineFor(n.End())-p.lineFor(n.Pos()) > 1 + return p.lineFor(n.End())-p.lineFor(n.Pos()) > 0 } func (p *printer) fieldList(fields *ast.FieldList, isStruct, isIncomplete bool) { diff --git a/libgo/go/go/printer/testdata/declarations.golden b/libgo/go/go/printer/testdata/declarations.golden index 7ed7cb61ae5..71ed32ed145 100644 --- a/libgo/go/go/printer/testdata/declarations.golden +++ b/libgo/go/go/printer/testdata/declarations.golden @@ -500,7 +500,7 @@ type _ struct { type _ struct { a, b, - c, d int // this line should be indented + c, d int // this line should be indented u, v, w, x float // this line should be indented p, q, r, s float // this line should be indented @@ -562,10 +562,21 @@ var a2, b2, var ( a3, b3, - c3, d3 int // this line should be indented + c3, d3 int // this line should be indented a4, b4, c4 int // this line should be indented ) +// Test case from issue 3304: multi-line declarations must end +// a formatting section and not influence indentation of the +// next line. +var ( + minRefreshTimeSec = flag.Int64("min_refresh_time_sec", 604800, + "minimum time window between two refreshes for a given user.") + x = flag.Int64("refresh_user_rollout_percent", 100, + "temporary flag to ramp up the refresh user rpc") + aVeryLongVariableName = stats.GetVarInt("refresh-user-count") +) + func _() { var privateKey2 = &Block{Type: "RSA PRIVATE KEY", Headers: map[string]string{}, diff --git a/libgo/go/go/printer/testdata/declarations.input b/libgo/go/go/printer/testdata/declarations.input index df8c2b167e1..d74cff25d1f 100644 --- a/libgo/go/go/printer/testdata/declarations.input +++ b/libgo/go/go/printer/testdata/declarations.input @@ -577,6 +577,16 @@ c3, d3 int // this line should be indented a4, b4, c4 int // this line should be indented ) +// Test case from issue 3304: multi-line declarations must end +// a formatting section and not influence indentation of the +// next line. +var ( + minRefreshTimeSec = flag.Int64("min_refresh_time_sec", 604800, + "minimum time window between two refreshes for a given user.") + x = flag.Int64("refresh_user_rollout_percent", 100, + "temporary flag to ramp up the refresh user rpc") + aVeryLongVariableName = stats.GetVarInt("refresh-user-count") +) func _() { var privateKey2 = &Block{Type: "RSA PRIVATE KEY", |