@@ -882,13 +882,10 @@ fn print_expr(s: ps, expr: @ast::expr) {
882
882
}
883
883
ast:: expr_field ( expr, id) {
884
884
// Deal with '10.x'
885
- alt expr. node {
886
- ast:: expr_lit ( @{ node: ast:: lit_int ( _) , _} ) {
885
+ if ends_in_lit_int ( expr) {
887
886
popen ( s) ; print_expr ( s, expr) ; pclose ( s) ;
888
- }
889
- _ {
887
+ } else {
890
888
print_expr_parens_if_unary_or_ret ( s, expr) ;
891
- }
892
889
}
893
890
word ( s. s , "." ) ;
894
891
word ( s. s , id) ;
@@ -1638,6 +1635,25 @@ fn ast_ty_constrs_str(constrs: [@ast::ty_constr]) -> str {
1638
1635
ret s;
1639
1636
}
1640
1637
1638
+ fn ends_in_lit_int ( ex : @ast:: expr ) -> bool {
1639
+ alt ex. node {
1640
+ ast:: expr_lit ( @{ node: ast:: lit_int ( _) , _} ) { true }
1641
+ ast:: expr_binary ( _, _, sub) | ast:: expr_unary ( _, sub) |
1642
+ ast:: expr_ternary ( _, _, sub) | ast:: expr_move ( _, sub) |
1643
+ ast:: expr_copy ( sub) | ast:: expr_assign ( _, sub) | ast:: expr_be ( sub) |
1644
+ ast:: expr_assign_op ( _, _, sub) | ast:: expr_swap ( _, sub) |
1645
+ ast:: expr_log ( _, sub) | ast:: expr_assert ( sub) | ast:: expr_uniq ( sub) |
1646
+ ast:: expr_check ( _, sub) { ends_in_lit_int ( sub) }
1647
+ ast:: expr_fail ( osub) | ast:: expr_ret ( osub) | ast:: expr_put ( osub) {
1648
+ alt osub {
1649
+ some( ex) { ends_in_lit_int ( ex) }
1650
+ _ { false }
1651
+ }
1652
+ }
1653
+ _ { false }
1654
+ }
1655
+ }
1656
+
1641
1657
//
1642
1658
// Local Variables:
1643
1659
// mode: rust
0 commit comments