@@ -840,8 +840,13 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
840
840
}
841
841
bclose_ ( s, expr. span , alt_indent_unit) ;
842
842
}
843
- ast:: expr_fn ( proto, decl, body, captures) { // NDM captures
844
- head ( s, proto_to_str ( proto) ) ;
843
+ ast:: expr_fn ( proto, decl, body, cap_clause) {
844
+ // containing cbox, will be closed by print-block at }
845
+ cbox ( s, indent_unit) ;
846
+ // head-box, will be closed by print-block at start
847
+ ibox ( s, 0 u) ;
848
+ word ( s. s , proto_to_str ( proto) ) ;
849
+ print_cap_clause ( s, * cap_clause) ;
845
850
print_fn_args_and_ret ( s, decl) ;
846
851
space ( s. s ) ;
847
852
print_block ( s, body) ;
@@ -1156,6 +1161,33 @@ fn print_fn(s: ps, decl: ast::fn_decl, name: ast::ident,
1156
1161
print_fn_args_and_ret ( s, decl) ;
1157
1162
}
1158
1163
1164
+ fn print_cap_clause ( s : ps , cap_clause : ast:: capture_clause ) {
1165
+ fn print_cap_item ( s : ps , & & cap_item: @ast:: capture_item ) {
1166
+ word ( s. s , cap_item. name ) ;
1167
+ }
1168
+
1169
+ let has_copies = vec:: is_not_empty ( cap_clause. copies ) ;
1170
+ let has_moves = vec:: is_not_empty ( cap_clause. moves ) ;
1171
+ if !has_copies && !has_moves { ret; }
1172
+
1173
+ word ( s. s , "[" ) ;
1174
+
1175
+ if has_copies {
1176
+ word_nbsp ( s, "copy" ) ;
1177
+ commasep ( s, inconsistent, cap_clause. copies , print_cap_item) ;
1178
+ if has_moves {
1179
+ word_space ( s, ";" ) ;
1180
+ }
1181
+ }
1182
+
1183
+ if has_moves {
1184
+ word_nbsp ( s, "move" ) ;
1185
+ commasep ( s, inconsistent, cap_clause. moves , print_cap_item) ;
1186
+ }
1187
+
1188
+ word ( s. s , "]" ) ;
1189
+ }
1190
+
1159
1191
fn print_fn_args_and_ret ( s : ps , decl : ast:: fn_decl ) {
1160
1192
popen ( s) ;
1161
1193
fn print_arg ( s : ps , x : ast:: arg ) {
0 commit comments