syntax: implement labelled breaks for for.

`for` desugars to `loop` so it is trivial to just desugar to `loop` while
retaining any label.
This commit is contained in:
Huon Wilson
2013-09-08 22:08:01 +10:00
parent b609d022c4
commit 07351b44c6
9 changed files with 32 additions and 16 deletions

View File

@@ -1232,7 +1232,12 @@ pub fn print_expr(s: @ps, expr: &ast::Expr) {
space(s.s);
print_block(s, blk);
}
ast::ExprForLoop(pat, iter, ref blk) => {
ast::ExprForLoop(pat, iter, ref blk, opt_ident) => {
for ident in opt_ident.iter() {
word(s.s, "'");
print_ident(s, *ident);
word_space(s, ":");
}
head(s, "for");
print_pat(s, pat);
space(s.s);