@@ -105,7 +105,7 @@ fn path_to_str(p: &ast::path) -> str { be to_str(p, print_path); }
105
105
fn fun_to_str ( f : & ast:: _fn , name : str , params : & ast:: ty_param [ ] ) -> str {
106
106
let writer = ioivec:: string_writer ( ) ;
107
107
let s = rust_printer ( writer. get_writer ( ) ) ;
108
- print_fn ( s, f. decl , f. proto , name, params) ;
108
+ print_fn ( s, f. decl , f. proto , name, params, f . decl . constraints ) ;
109
109
eof ( s. s ) ;
110
110
ret writer. get_str ( ) ;
111
111
}
@@ -337,8 +337,6 @@ fn print_type(s: &ps, ty: &ast::ty) {
337
337
ast:: ty_constr ( t, cs) {
338
338
print_type ( s, * t) ;
339
339
space ( s. s ) ;
340
- word ( s. s , ":" ) ;
341
- space ( s. s ) ;
342
340
word ( s. s , ast_ty_constrs_str ( cs) ) ;
343
341
}
344
342
}
@@ -363,7 +361,8 @@ fn print_native_item(s: &ps, item: &@ast::native_item) {
363
361
364
362
365
363
ast:: native_item_fn ( lname, decl, typarams) {
366
- print_fn ( s, decl, ast:: proto_fn, item. ident , typarams) ;
364
+ print_fn ( s, decl, ast:: proto_fn, item. ident , typarams,
365
+ decl. constraints ) ;
367
366
alt lname {
368
367
none. { }
369
368
some( ss) { space ( s. s ) ; word_space ( s, "=" ) ; print_string ( s, ss) ; }
@@ -396,7 +395,8 @@ fn print_item(s: &ps, item: &@ast::item) {
396
395
397
396
}
398
397
ast:: item_fn ( _fn, typarams) {
399
- print_fn ( s, _fn. decl , _fn. proto , item. ident , typarams) ;
398
+ print_fn ( s, _fn. decl , _fn. proto , item. ident , typarams,
399
+ _fn. decl . constraints ) ;
400
400
word ( s. s , " " ) ;
401
401
print_block ( s, _fn. body ) ;
402
402
}
@@ -502,7 +502,7 @@ fn print_item(s: &ps, item: &@ast::item) {
502
502
hardbreak_if_not_bol ( s) ;
503
503
maybe_print_comment ( s, meth. span . lo ) ;
504
504
print_fn ( s, meth. node . meth . decl , meth. node . meth . proto ,
505
- meth. node . ident , typarams) ;
505
+ meth. node . ident , typarams, ~ [ ] ) ;
506
506
word ( s. s , " " ) ;
507
507
print_block ( s, meth. node . meth . body ) ;
508
508
}
@@ -821,7 +821,7 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
821
821
}
822
822
ast:: expr_fn ( f) {
823
823
head ( s, proto_to_str ( f. proto ) ) ;
824
- print_fn_args_and_ret ( s, f. decl ) ;
824
+ print_fn_args_and_ret ( s, f. decl , ~ [ ] ) ;
825
825
space ( s. s ) ;
826
826
print_block ( s, f. body ) ;
827
827
}
@@ -970,12 +970,12 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
970
970
bopen ( s) ;
971
971
972
972
// Methods
973
- for meth: @ast:: method in anon_obj. methods {
973
+ for meth: @ast:: method in anon_obj. methods {
974
974
let typarams: ast:: ty_param [ ] = ~[ ] ;
975
975
hardbreak_if_not_bol ( s) ;
976
976
maybe_print_comment ( s, meth. span . lo ) ;
977
977
print_fn ( s, meth. node . meth . decl , meth. node . meth . proto ,
978
- meth. node . ident , typarams) ;
978
+ meth. node . ident , typarams, ~ [ ] ) ;
979
979
word ( s. s , " " ) ;
980
980
print_block ( s, meth. node . meth . body ) ;
981
981
}
@@ -1102,17 +1102,18 @@ fn print_pat(s: &ps, pat: &@ast::pat) {
1102
1102
}
1103
1103
1104
1104
fn print_fn ( s : & ps , decl : ast:: fn_decl , proto : ast:: proto , name : str ,
1105
- typarams : & ast:: ty_param [ ] ) {
1105
+ typarams : & ast:: ty_param [ ] , constrs : ( @ast :: constr ) [ ] ) {
1106
1106
alt decl. purity {
1107
1107
ast:: impure_fn. { head ( s, proto_to_str ( proto) ) ; }
1108
1108
_ { head( s, "pred" ) ; }
1109
1109
}
1110
1110
word ( s. s , name) ;
1111
1111
print_type_params ( s, typarams) ;
1112
- print_fn_args_and_ret ( s, decl) ;
1112
+ print_fn_args_and_ret ( s, decl, constrs ) ;
1113
1113
}
1114
1114
1115
- fn print_fn_args_and_ret ( s : & ps , decl : & ast:: fn_decl ) {
1115
+ fn print_fn_args_and_ret ( s : & ps , decl : & ast:: fn_decl ,
1116
+ constrs : ( @ast:: constr ) [ ] ) {
1116
1117
popen ( s) ;
1117
1118
fn print_arg ( s : & ps , x : & ast:: arg ) {
1118
1119
ibox ( s, indent_unit) ;
@@ -1123,6 +1124,7 @@ fn print_fn_args_and_ret(s: &ps, decl: &ast::fn_decl) {
1123
1124
}
1124
1125
commasep ( s, inconsistent, decl. inputs , print_arg) ;
1125
1126
pclose ( s) ;
1127
+ word ( s. s , ast_constrs_str ( constrs) ) ;
1126
1128
maybe_print_comment ( s, decl. output . span . lo ) ;
1127
1129
if decl. output . node != ast:: ty_nil {
1128
1130
space_if_not_bol ( s) ;
@@ -1275,7 +1277,7 @@ fn print_ty_fn(s: &ps, proto: &ast::proto, id: &option::t[str],
1275
1277
}
1276
1278
end ( s) ;
1277
1279
}
1278
- word_space ( s, ast_constrs_str ( constrs) ) ;
1280
+ word ( s . s , ast_constrs_str ( constrs) ) ;
1279
1281
end ( s) ;
1280
1282
}
1281
1283
0 commit comments