@@ -100,7 +100,9 @@ fn stmt_to_str(s: &ast::stmt) -> str { be to_str(s, print_stmt); }
100
100
101
101
fn item_to_str ( i : & @ast:: item ) -> str { be to_str ( i, print_item) ; }
102
102
103
- fn path_to_str ( p : & ast:: path ) -> str { be to_str ( p, print_path) ; }
103
+ fn path_to_str ( p : & ast:: path ) -> str {
104
+ be to_str ( p, bind print_path ( _, _, false ) ) ;
105
+ }
104
106
105
107
fn fun_to_str ( f : & ast:: _fn , name : str , params : & [ ast:: ty_param ] ) -> str {
106
108
let writer = io:: string_writer ( ) ;
@@ -341,7 +343,7 @@ fn print_type(s: &ps, ty: &@ast::ty) {
341
343
}
342
344
bclose ( s, ty. span ) ;
343
345
}
344
- ast:: ty_path ( path, _) { print_path ( s, path) ; }
346
+ ast:: ty_path ( path, _) { print_path ( s, path, false ) ; }
345
347
ast:: ty_type. { word ( s. s , "type" ) ; }
346
348
ast:: ty_constr ( t, cs) {
347
349
print_type ( s, t) ;
@@ -690,7 +692,7 @@ fn print_mac(s: &ps, m: &ast::mac) {
690
692
alt m. node {
691
693
ast:: mac_invoc ( path, arg, body) {
692
694
word ( s. s , "#" ) ;
693
- print_path ( s, path) ;
695
+ print_path ( s, path, false ) ;
694
696
alt ( arg. node ) {
695
697
ast:: expr_vec ( _, _, _) { }
696
698
_ { word( s. s , " " ) ; }
@@ -933,7 +935,7 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
933
935
print_expr ( s, index) ;
934
936
pclose ( s) ;
935
937
}
936
- ast:: expr_path ( path) { print_path ( s, path) ; }
938
+ ast:: expr_path ( path) { print_path ( s, path, true ) ; }
937
939
ast:: expr_fail ( maybe_fail_val) {
938
940
word ( s. s , "fail" ) ;
939
941
alt maybe_fail_val {
@@ -1088,7 +1090,7 @@ fn print_for_decl(s: &ps, loc: &@ast::local, coll: &@ast::expr) {
1088
1090
print_expr ( s, coll) ;
1089
1091
}
1090
1092
1091
- fn print_path ( s : & ps , path : & ast:: path ) {
1093
+ fn print_path ( s : & ps , path : & ast:: path , colons_before_params : bool ) {
1092
1094
maybe_print_comment ( s, path. span . lo ) ;
1093
1095
if path. node . global { word ( s. s , "::" ) ; }
1094
1096
let first = true ;
@@ -1097,6 +1099,7 @@ fn print_path(s: &ps, path: &ast::path) {
1097
1099
word ( s. s , id) ;
1098
1100
}
1099
1101
if vec:: len ( path. node . types ) > 0 u {
1102
+ if colons_before_params { word ( s. s , "::" ) ; }
1100
1103
word ( s. s , "<" ) ;
1101
1104
commasep ( s, inconsistent, path. node . types , print_type) ;
1102
1105
word ( s. s , ">" ) ;
@@ -1112,7 +1115,7 @@ fn print_pat(s: &ps, pat: &@ast::pat) {
1112
1115
ast:: pat_bind ( id) { word ( s. s , id) ; }
1113
1116
ast:: pat_lit ( lit) { print_literal ( s, lit) ; }
1114
1117
ast:: pat_tag ( path, args) {
1115
- print_path ( s, path) ;
1118
+ print_path ( s, path, true ) ;
1116
1119
if vec:: len ( args) > 0 u {
1117
1120
popen ( s) ;
1118
1121
commasep ( s, inconsistent, args, print_pat) ;
0 commit comments