about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-10-06 12:26:12 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-10-07 09:09:50 +0200
commitf9fbd86f52cf597b85359ade1ca60b8d6ebf7286 (patch)
treed6f0cdd039642052f3ccb4ba8f3b9821bb7cbaaf /src/comp/syntax/parse
parent4709038d641ad009b44ed2bf5980fa3a252d6927 (diff)
downloadrust-f9fbd86f52cf597b85359ade1ca60b8d6ebf7286.tar.gz
rust-f9fbd86f52cf597b85359ade1ca60b8d6ebf7286.zip
Parse and typecheck by-value and by-ref arg specs
Add sprinkle && throughout the compiler to make it typecheck again.

Issue #1008
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 53c3aa01bf0..e220149f6f8 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -587,17 +587,11 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
 }
 
 fn parse_arg_mode(p: parser) -> ast::mode {
-    if eat(p, token::BINOP(token::AND)) {
-        ret ast::by_mut_ref;
-    } else if eat(p, token::BINOP(token::MINUS)) {
-        ret ast::by_move;
-    } else {
-        // FIXME Temporarily ignore these, to make it possible to implement
-        // them without breaking the stage0 build.
-        eat(p, token::ANDAND);
-        eat(p, token::BINOP(token::PLUS));
-        ret ast::by_ref;
-    }
+    if eat(p, token::BINOP(token::AND)) { ast::by_mut_ref }
+    else if eat(p, token::BINOP(token::MINUS)) { ast::by_move }
+    else if eat(p, token::ANDAND) { ast::by_ref }
+    else if eat(p, token::BINOP(token::PLUS)) { ast::by_val }
+    else { ast::mode_infer }
 }
 
 fn parse_arg(p: parser) -> ast::arg {
@@ -1890,7 +1884,8 @@ fn parse_item_res(p: parser, attrs: [ast::attribute]) -> @ast::item {
     let dtor = parse_block_no_value(p);
     let decl =
         {inputs:
-             [{mode: ast::by_ref, ty: t, ident: arg_ident, id: p.get_id()}],
+             [{mode: ast::by_ref, ty: t, ident: arg_ident,
+               id: p.get_id()}],
          output: @spanned(lo, lo, ast::ty_nil),
          purity: ast::impure_fn,
          il: ast::il_normal,