@@ -79,7 +79,7 @@ fn item_to_str(&@ast::item ty) -> str { be to_str(ty, print_item); }
79
79
fn fun_to_str ( & ast:: _fn f, str name , vec[ ast:: ty_param ] params ) -> str {
80
80
auto writer = io:: string_writer ( ) ;
81
81
auto s = rust_printer ( writer. get_writer ( ) ) ;
82
- print_fn ( s, f. decl , name, params) ;
82
+ print_fn ( s, f. decl , f . proto , name, params) ;
83
83
eof ( s. s ) ;
84
84
ret writer. get_str ( ) ;
85
85
}
@@ -279,7 +279,7 @@ fn print_item(&ps s, &@ast::item item) {
279
279
end ( s. s ) ; // end the outer cbox
280
280
}
281
281
case ( ast:: item_fn ( ?name, ?_fn, ?typarams, _, _) ) {
282
- print_fn ( s, _fn. decl , name, typarams) ;
282
+ print_fn ( s, _fn. decl , _fn . proto , name, typarams) ;
283
283
word ( s. s , " " ) ;
284
284
print_block ( s, _fn. body ) ;
285
285
}
@@ -312,7 +312,7 @@ fn print_item(&ps s, &@ast::item item) {
312
312
}
313
313
case ( ast:: native_item_fn ( ?id, ?lname, ?decl,
314
314
?typarams, _, _) ) {
315
- print_fn ( s, decl, id, typarams) ;
315
+ print_fn ( s, decl, ast :: proto_fn , id, typarams) ;
316
316
end ( s. s ) ; // end head-ibox
317
317
alt ( lname) {
318
318
case ( option:: none[ str] ) { }
@@ -388,7 +388,8 @@ fn print_item(&ps s, &@ast::item item) {
388
388
let vec[ ast:: ty_param] typarams = [ ] ;
389
389
hardbreak ( s. s ) ;
390
390
maybe_print_comment ( s, meth. span . lo ) ;
391
- print_fn ( s, meth. node . meth . decl , meth. node . ident , typarams) ;
391
+ print_fn ( s, meth. node . meth . decl , meth. node . meth . proto ,
392
+ meth. node . ident , typarams) ;
392
393
word ( s. s , " " ) ;
393
394
print_block ( s, meth. node . meth . body ) ;
394
395
}
@@ -934,11 +935,15 @@ fn print_pat(&ps s, &@ast::pat pat) {
934
935
}
935
936
}
936
937
937
- fn print_fn ( & ps s, ast:: fn_decl decl, str name ,
938
+ fn print_fn ( & ps s, ast:: fn_decl decl, ast :: proto proto , str name ,
938
939
vec[ ast:: ty_param ] typarams ) {
939
940
alt ( decl. purity ) {
940
941
case ( ast:: impure_fn) {
941
- head ( s, "fn" ) ;
942
+ if ( proto == ast:: proto_iter) {
943
+ head ( s, "iter" ) ;
944
+ } else {
945
+ head ( s, "fn" ) ;
946
+ }
942
947
}
943
948
case ( _) {
944
949
head ( s, "pred" ) ;
0 commit comments