1
Fork 0

syntax: implement foreach .. in .. { .. } via desugaring.

This commit is contained in:
Graydon Hoare 2013-07-29 17:25:00 -07:00
parent 9a2d183d6a
commit c29e9fb60b
17 changed files with 215 additions and 3 deletions

View file

@ -1228,6 +1228,14 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
space(s.s);
print_block(s, blk);
}
ast::expr_for_loop(pat, iter, ref blk) => {
head(s, "foreach");
print_pat(s, pat);
word_space(s, "in");
print_expr(s, iter);
space(s.s);
print_block(s, blk);
}
ast::expr_loop(ref blk, opt_ident) => {
for opt_ident.iter().advance |ident| {
word(s.s, "'");