about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-01-03 15:08:48 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-01-13 14:45:21 -0800
commit119c6141f568b8b5bca141b24d3cbd3e1aacb2c7 (patch)
treedd7f94c989ed3b4f59408e84577deab696b73930 /src/libsyntax/ext
parentce358fca333db7bc0ac1bffa1daa13099b2561d8 (diff)
downloadrust-119c6141f568b8b5bca141b24d3cbd3e1aacb2c7.tar.gz
rust-119c6141f568b8b5bca141b24d3cbd3e1aacb2c7.zip
librustc: Remove `@` pointer patterns from the language
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/base.rs7
-rw-r--r--src/libsyntax/ext/expand.rs115
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs16
3 files changed, 69 insertions, 69 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 76135f31e31..8515c3aba50 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -324,7 +324,7 @@ impl ExtCtxt {
     pub fn cfg(&self) -> ast::CrateConfig { self.cfg.clone() }
     pub fn call_site(&self) -> Span {
         match self.backtrace {
-            Some(@ExpnInfo {call_site: cs, ..}) => cs,
+            Some(expn_info) => expn_info.call_site,
             None => self.bug("missing top span")
         }
     }
@@ -346,10 +346,7 @@ impl ExtCtxt {
     }
     pub fn bt_pop(&mut self) {
         match self.backtrace {
-            Some(@ExpnInfo {
-                call_site: Span {expn_info: prev, ..}, ..}) => {
-                self.backtrace = prev
-            }
+            Some(expn_info) => self.backtrace = expn_info.call_site.expn_info,
             _ => self.bug("tried to pop without a push")
         }
     }
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index a9cf807ff65..303277afbe8 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -471,63 +471,66 @@ fn expand_non_macro_stmt(s: &Stmt, fld: &mut MacroExpander)
                          -> SmallVector<@Stmt> {
     // is it a let?
     match s.node {
-        StmtDecl(@Spanned {
-            node: DeclLocal(ref local),
-            span: stmt_span
-        },
-        node_id) => {
-
-            // take it apart:
-            let @Local {
-                ty: _,
-                pat: pat,
-                init: init,
-                id: id,
-                span: span
-            } = *local;
-            // expand the pat (it might contain exprs... #:(o)>
-            let expanded_pat = fld.fold_pat(pat);
-            // find the pat_idents in the pattern:
-            // oh dear heaven... this is going to include the enum names, as well....
-            // ... but that should be okay, as long as the new names are gensyms
-            // for the old ones.
-            let mut name_finder = new_name_finder(~[]);
-            name_finder.visit_pat(expanded_pat,());
-            // generate fresh names, push them to a new pending list
-            let mut new_pending_renames = ~[];
-            for ident in name_finder.ident_accumulator.iter() {
-                let new_name = fresh_name(ident);
-                new_pending_renames.push((*ident,new_name));
-            }
-            let rewritten_pat = {
-                let mut rename_fld =
-                    renames_to_fold(&mut new_pending_renames);
-                // rewrite the pattern using the new names (the old ones
-                // have already been applied):
-                rename_fld.fold_pat(expanded_pat)
-            };
-            // add them to the existing pending renames:
-            for pr in new_pending_renames.iter() {
-                fld.extsbox.info().pending_renames.push(*pr)
+        StmtDecl(decl, node_id) => {
+            match *decl {
+                Spanned {
+                    node: DeclLocal(ref local),
+                    span: stmt_span
+                } => {
+                    // take it apart:
+                    let Local {
+                        ty: _,
+                        pat: pat,
+                        init: init,
+                        id: id,
+                        span: span
+                    } = **local;
+                    // expand the pat (it might contain exprs... #:(o)>
+                    let expanded_pat = fld.fold_pat(pat);
+                    // find the pat_idents in the pattern:
+                    // oh dear heaven... this is going to include the enum
+                    // names, as well... but that should be okay, as long as
+                    // the new names are gensyms for the old ones.
+                    let mut name_finder = new_name_finder(~[]);
+                    name_finder.visit_pat(expanded_pat,());
+                    // generate fresh names, push them to a new pending list
+                    let mut new_pending_renames = ~[];
+                    for ident in name_finder.ident_accumulator.iter() {
+                        let new_name = fresh_name(ident);
+                        new_pending_renames.push((*ident,new_name));
+                    }
+                    let rewritten_pat = {
+                        let mut rename_fld =
+                            renames_to_fold(&mut new_pending_renames);
+                        // rewrite the pattern using the new names (the old
+                        // ones have already been applied):
+                        rename_fld.fold_pat(expanded_pat)
+                    };
+                    // add them to the existing pending renames:
+                    for pr in new_pending_renames.iter() {
+                        fld.extsbox.info().pending_renames.push(*pr)
+                    }
+                    // also, don't forget to expand the init:
+                    let new_init_opt = init.map(|e| fld.fold_expr(e));
+                    let rewritten_local =
+                        @Local {
+                            ty: local.ty,
+                            pat: rewritten_pat,
+                            init: new_init_opt,
+                            id: id,
+                            span: span,
+                        };
+                    SmallVector::one(@Spanned {
+                        node: StmtDecl(@Spanned {
+                                node: DeclLocal(rewritten_local),
+                                span: stmt_span
+                            },
+                            node_id),
+                        span: span
+                    })
+                }
+                _ => noop_fold_stmt(s, fld),
             }
-            // also, don't forget to expand the init:
-            let new_init_opt = init.map(|e| fld.fold_expr(e));
-            let rewritten_local =
-                @Local {
-                    ty: local.ty,
-                    pat: rewritten_pat,
-                    init: new_init_opt,
-                    id: id,
-                    span: span,
-                };
-            SmallVector::one(@Spanned {
-                node: StmtDecl(@Spanned {
-                        node: DeclLocal(rewritten_local),
-                        span: stmt_span
-                    },
-                    node_id),
-                span: span
-            })
         },
         _ => noop_fold_stmt(s, fld),
     }
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index dc5eb0e9537..cb7d54d7305 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -126,15 +126,15 @@ fn generic_extension(cx: &ExtCtxt,
     let s_d = cx.parse_sess().span_diagnostic;
 
     for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers
-        match *lhs {
-          @MatchedNonterminal(NtMatchers(ref mtcs)) => {
+        match **lhs {
+          MatchedNonterminal(NtMatchers(ref mtcs)) => {
             // `none` is because we're not interpolating
             let arg_rdr = new_tt_reader(s_d, None, arg.to_owned()) as @Reader;
             match parse(cx.parse_sess(), cx.cfg(), arg_rdr, *mtcs) {
               Success(named_matches) => {
-                let rhs = match rhses[i] {
+                let rhs = match *rhses[i] {
                     // okay, what's your transcriber?
-                    @MatchedNonterminal(NtTT(@ref tt)) => {
+                    MatchedNonterminal(NtTT(tt)) => {
                         match (*tt) {
                             // cut off delimiters; don't parse 'em
                             TTDelim(ref tts) => {
@@ -214,13 +214,13 @@ pub fn add_new_extension(cx: &mut ExtCtxt,
                                      argument_gram);
 
     // Extract the arguments:
-    let lhses = match *argument_map.get(&lhs_nm) {
-        @MatchedSeq(ref s, _) => /* FIXME (#2543) */ @(*s).clone(),
+    let lhses = match **argument_map.get(&lhs_nm) {
+        MatchedSeq(ref s, _) => /* FIXME (#2543) */ @(*s).clone(),
         _ => cx.span_bug(sp, "wrong-structured lhs")
     };
 
-    let rhses = match *argument_map.get(&rhs_nm) {
-        @MatchedSeq(ref s, _) => /* FIXME (#2543) */ @(*s).clone(),
+    let rhses = match **argument_map.get(&rhs_nm) {
+        MatchedSeq(ref s, _) => /* FIXME (#2543) */ @(*s).clone(),
         _ => cx.span_bug(sp, "wrong-structured rhs")
     };