@@ -848,7 +848,7 @@ fn print_expr(&ps s, &@ast::expr expr) {
848
848
bclose ( s, expr. span ) ;
849
849
}
850
850
case ( ast:: expr_fn ( ?f) ) {
851
- head ( s, "fn" ) ;
851
+ head ( s, proto_to_str ( f . proto ) ) ;
852
852
print_fn_args_and_ret ( s, f. decl ) ;
853
853
space ( s. s ) ;
854
854
print_block ( s, f. body ) ;
@@ -1147,9 +1147,7 @@ fn print_fn(&ps s, ast::fn_decl decl, ast::proto proto, str name,
1147
1147
& ast:: ty_param[ ] typarams) {
1148
1148
alt ( decl. purity) {
1149
1149
case ( ast:: impure_fn ) {
1150
- if ( proto == ast:: proto_iter ) {
1151
- head( s, "iter" ) ;
1152
- } else { head( s, "fn" ) ; }
1150
+ head ( s , proto_to_str ( proto ) ) ;
1153
1151
}
1154
1152
case ( _) { head ( s, "pred" ) ; }
1155
1153
}
@@ -1308,9 +1306,7 @@ fn print_ty_fn(&ps s, &ast::proto proto, &option::t[str] id,
1308
1306
& ast:: ty_arg[ ] inputs, & @ast:: ty output,
1309
1307
& ast:: controlflow cf, & ( @ast:: constr) [ ] constrs ) {
1310
1308
ibox ( s, indent_unit) ;
1311
- if ( proto == ast:: proto_fn) {
1312
- word ( s. s , "fn" ) ;
1313
- } else { word ( s. s , "iter" ) ; }
1309
+ word ( s. s , proto_to_str ( proto) ) ;
1314
1310
alt ( id) {
1315
1311
case ( some ( ?id) ) { word ( s. s , " " ) ; word ( s. s , id) ; }
1316
1312
case ( _) { }
@@ -1565,6 +1561,13 @@ fn ast_constrs_str(&(@ast::constr)[] constrs) -> str {
1565
1561
ret s;
1566
1562
}
1567
1563
1564
+ fn proto_to_str ( & ast:: proto p) -> str {
1565
+ ret alt ( p) {
1566
+ ast:: proto_fn { "fn" }
1567
+ ast:: proto_iter { "iter" }
1568
+ } ;
1569
+ }
1570
+
1568
1571
//
1569
1572
// Local Variables:
1570
1573
// mode: rust
0 commit comments