Skip to content

Commit 035d60d

Browse files
committed
Fix interference between if-check and if printing.
1 parent 1ad8efa commit 035d60d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/comp/pretty/pprust.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,11 @@ fn print_block(&ps s, ast::block blk) {
503503
}
504504

505505
fn print_if(&ps s, &@ast::expr test, &ast::block block,
506-
&option::t[@ast::expr] elseopt, &str chk) {
506+
&option::t[@ast::expr] elseopt, bool chk) {
507507
head(s, "if");
508-
word_space(s, chk);
508+
if (chk) {
509+
word_nbsp(s, "check");
510+
}
509511
popen(s);
510512
print_expr(s, test);
511513
pclose(s);
@@ -651,10 +653,10 @@ fn print_expr(&ps s, &@ast::expr expr) {
651653
print_type(s, *ty);
652654
}
653655
case (ast::expr_if(?test, ?block, ?elseopt, _)) {
654-
print_if(s, test, block, elseopt, "");
656+
print_if(s, test, block, elseopt, false);
655657
}
656658
case (ast::expr_if_check(?test, ?block, ?elseopt, _)) {
657-
print_if(s, test, block, elseopt, "check");
659+
print_if(s, test, block, elseopt, true);
658660
}
659661
case (ast::expr_while(?test, ?block, _)) {
660662
head(s, "while");

0 commit comments

Comments
 (0)