Add representation for by-ref let bindings

Issue #918
This commit is contained in:
Marijn Haverbeke 2011-09-15 11:42:56 +02:00
parent 197f360e30
commit 1cda74deee
12 changed files with 31 additions and 19 deletions

View file

@ -1505,11 +1505,13 @@ fn parse_local(p: parser, allow_init: bool) -> @ast::local {
}
fn parse_let(p: parser) -> @ast::decl {
fn parse_let_style(p: parser) -> ast::let_style {
eat(p, token::BINOP(token::AND)) ? ast::let_ref : ast::let_copy
}
let lo = p.get_lo_pos();
let locals = [parse_local(p, true)];
while p.peek() == token::COMMA {
p.bump();
locals += [parse_local(p, true)];
let locals = [(parse_let_style(p), parse_local(p, true))];
while eat(p, token::COMMA) {
locals += [(parse_let_style(p), parse_local(p, true))];
}
ret @spanned(lo, p.get_last_hi_pos(), ast::decl_local(locals));
}