@@ -718,7 +718,7 @@ fn print_expr(s: ps, expr: @ast::expr) {
718
718
pclose ( s) ;
719
719
}
720
720
ast:: expr_call ( func, args) {
721
- print_expr_parens_if_unary_or_ret ( s, func) ;
721
+ print_expr_parens_if_not_bot ( s, func) ;
722
722
popen ( s) ;
723
723
commasep_exprs ( s, inconsistent, args) ;
724
724
pclose ( s) ;
@@ -885,13 +885,13 @@ fn print_expr(s: ps, expr: @ast::expr) {
885
885
if ends_in_lit_int ( expr) {
886
886
popen ( s) ; print_expr ( s, expr) ; pclose ( s) ;
887
887
} else {
888
- print_expr_parens_if_unary_or_ret ( s, expr) ;
888
+ print_expr_parens_if_not_bot ( s, expr) ;
889
889
}
890
890
word ( s. s , "." ) ;
891
891
word ( s. s , id) ;
892
892
}
893
893
ast:: expr_index ( expr, index) {
894
- print_expr_parens_if_unary_or_ret ( s, expr) ;
894
+ print_expr_parens_if_not_bot ( s, expr) ;
895
895
word ( s. s , "[" ) ;
896
896
print_expr ( s, index) ;
897
897
word ( s. s , "]" ) ;
@@ -993,10 +993,15 @@ fn print_expr(s: ps, expr: @ast::expr) {
993
993
end ( s) ;
994
994
}
995
995
996
- fn print_expr_parens_if_unary_or_ret ( s : ps , ex : @ast:: expr ) {
996
+ fn print_expr_parens_if_not_bot ( s : ps , ex : @ast:: expr ) {
997
997
let parens = alt ex. node {
998
998
ast:: expr_fail ( _) | ast:: expr_ret ( _) | ast:: expr_put ( _) |
999
- ast:: expr_unary ( _, _) { true }
999
+ ast:: expr_binary ( _, _, _) | ast:: expr_unary ( _, _) |
1000
+ ast:: expr_ternary ( _, _, _) | ast:: expr_move ( _, _) |
1001
+ ast:: expr_copy ( _) | ast:: expr_assign ( _, _) | ast:: expr_be ( _) |
1002
+ ast:: expr_assign_op ( _, _, _) | ast:: expr_swap ( _, _) |
1003
+ ast:: expr_log ( _, _) | ast:: expr_assert ( _) | ast:: expr_uniq ( _) |
1004
+ ast:: expr_check ( _, _) { true }
1000
1005
_ { false }
1001
1006
} ;
1002
1007
if parens { popen ( s) ; }
0 commit comments