about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-01-14 20:52:28 -0800
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-01-14 20:52:28 -0800
commit4bcd19f6be51d7fb26b0930c8a3354b9222143ff (patch)
tree6ba0d0ef21b56fdb6a4e800c01f17d91f6972006 /src/libsyntax/parse
parent3ea3136e84659773fea9e6f89cb7ddf76cee2324 (diff)
downloadrust-4bcd19f6be51d7fb26b0930c8a3354b9222143ff.tar.gz
rust-4bcd19f6be51d7fb26b0930c8a3354b9222143ff.zip
Convert ast::{pat,field_pat,local_,arm} into structs
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index b7ecbbcaa19..770c942059e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1769,7 +1769,7 @@ impl Parser {
                 span: expr.span,
             };
 
-            arms.push({pats: pats, guard: guard, body: blk});
+            arms.push(ast::arm { pats: pats, guard: guard, body: blk });
         }
         let mut hi = self.span.hi;
         self.bump();
@@ -1833,9 +1833,9 @@ impl Parser {
             let subpat = self.parse_pat(refutable);
             if is_tail {
                 match subpat {
-                    @{ node: pat_wild, _ } => (),
-                    @{ node: pat_ident(_, _, _), _ } => (),
-                    @{ span, _ } => self.span_fatal(
+                    @ast::pat { node: pat_wild, _ } => (),
+                    @ast::pat { node: pat_ident(_, _, _), _ } => (),
+                    @ast::pat { span, _ } => self.span_fatal(
                         span, ~"expected an identifier or `_`"
                     )
                 }
@@ -1881,13 +1881,13 @@ impl Parser {
                 self.bump();
                 subpat = self.parse_pat(refutable);
             } else {
-                subpat = @{
+                subpat = @ast::pat {
                     id: self.get_id(),
                     node: pat_ident(bind_infer, fieldpath, None),
                     span: self.last_span
                 };
             }
-            fields.push({ident: fieldname, pat: subpat});
+            fields.push(ast::field_pat { ident: fieldname, pat: subpat });
         }
         return (fields, etc);
     }
@@ -2092,7 +2092,7 @@ impl Parser {
             hi = self.span.hi;
           }
         }
-        return @{id: self.get_id(), node: pat, span: mk_sp(lo, hi)};
+        @ast::pat { id: self.get_id(), node: pat, span: mk_sp(lo, hi) }
     }
 
     fn parse_pat_ident(refutable: bool,
@@ -2131,9 +2131,17 @@ impl Parser {
                        span: mk_sp(lo, lo)};
         if self.eat(token::COLON) { ty = self.parse_ty(false); }
         let init = if allow_init { self.parse_initializer() } else { None };
-        return @spanned(lo, self.last_span.hi,
-                     {is_mutbl: is_mutbl, ty: ty, pat: pat,
-                      init: init, id: self.get_id()});
+        @spanned(
+            lo,
+            self.last_span.hi,
+            ast::local_ {
+                is_mutbl: is_mutbl,
+                ty: ty,
+                pat: pat,
+                init: init,
+                id: self.get_id(),
+            }
+        )
     }
 
     fn parse_let() -> @decl {