about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-09-15 11:42:56 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-09-15 11:42:56 +0200
commit1cda74deee3bdd1e373502cf3298ac552da2b863 (patch)
treeb20afe955d342405c24acfa677acdf152dbff035 /src/comp/syntax/parse
parent197f360e30538f34398854e35366d8909b131057 (diff)
downloadrust-1cda74deee3bdd1e373502cf3298ac552da2b863.tar.gz
rust-1cda74deee3bdd1e373502cf3298ac552da2b863.zip
Add representation for by-ref let bindings
Issue #918
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 1ea3ddbec67..4a449c25a97 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -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));
 }