Commit f9057c7b authored by Robert Griesemer's avatar Robert Griesemer

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
parent c217c16a
...@@ -681,7 +681,7 @@ func (p *printer) decl(decl ast.Decl) (comment *ast.CommentGroup, optSemi bool) ...@@ -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. // Print the statement list indented, but without a newline after the last statement.
func (p *printer) stmtList(list []ast.Stmt) { func (p *printer) stmtList(list []ast.Stmt) {
if len(list) > 0 { if len(list) > 0 {
p.print(+1, newline); p.print(+1, formfeed); // the next lines have different structure
optSemi := false; optSemi := false;
for i, s := range list { for i, s := range list {
if i > 0 { if i > 0 {
......
...@@ -50,3 +50,10 @@ func f1() { ...@@ -50,3 +50,10 @@ func f1() {
/* 4 */ /* 4 */
f0() 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
}
...@@ -50,3 +50,11 @@ func f1() { ...@@ -50,3 +50,11 @@ func f1() {
/* 4 */ /* 4 */
f0(); 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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment