mirror of
https://github.com/golang/go
synced 2024-09-25 01:20:13 -06:00
break tabwriter columns when starting a new block of indented statements
R=r DELTA=16 (15 added, 0 deleted, 1 changed) OCL=32475 CL=32481
This commit is contained in:
parent
c217c16a06
commit
f9057c7b59
@ -681,7 +681,7 @@ func (p *printer) decl(decl ast.Decl) (comment *ast.CommentGroup, optSemi bool)
|
||||
// Print the statement list indented, but without a newline after the last statement.
|
||||
func (p *printer) stmtList(list []ast.Stmt) {
|
||||
if len(list) > 0 {
|
||||
p.print(+1, newline);
|
||||
p.print(+1, formfeed); // the next lines have different structure
|
||||
optSemi := false;
|
||||
for i, s := range list {
|
||||
if i > 0 {
|
||||
|
7
src/pkg/go/printer/testdata/golden1.go
vendored
7
src/pkg/go/printer/testdata/golden1.go
vendored
@ -50,3 +50,10 @@ func f1() {
|
||||
/* 4 */
|
||||
f0()
|
||||
}
|
||||
|
||||
func abs(x int) int {
|
||||
if x < 0 { // the tab printed before this comment's // must not affect the remaining lines
|
||||
return -x // this statement should be properly indented
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
8
src/pkg/go/printer/testdata/source1.go
vendored
8
src/pkg/go/printer/testdata/source1.go
vendored
@ -50,3 +50,11 @@ func f1() {
|
||||
/* 4 */
|
||||
f0();
|
||||
}
|
||||
|
||||
|
||||
func abs(x int) int {
|
||||
if x < 0 { // the tab printed before this comment's // must not affect the remaining lines
|
||||
return -x; // this statement should be properly indented
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user