about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-03-07 18:37:22 -0500
committerAlex Crichton <alex@alexcrichton.com>2013-03-08 09:54:20 -0500
commit7f99a02ddb3ff30388ae1dd5db06e332c215fea2 (patch)
treecfea745b79f58bad9266ddcb80490be166a45f5d /src/libsyntax/ext
parent2a72099063b21abc84145960a14224458b6dc37c (diff)
downloadrust-7f99a02ddb3ff30388ae1dd5db06e332c215fea2.tar.gz
rust-7f99a02ddb3ff30388ae1dd5db06e332c215fea2.zip
syntax: Remove uses of DVec
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/deriving.rs24
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs18
2 files changed, 18 insertions, 24 deletions
diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs
index 8c12bbad360..a1514bc3eab 100644
--- a/src/libsyntax/ext/deriving.rs
+++ b/src/libsyntax/ext/deriving.rs
@@ -29,7 +29,6 @@ use parse::token::special_idents::clownshoes_extensions;
 use ast_util;
 use opt_vec;
 
-use core::dvec;
 use core::uint;
 
 enum Junction {
@@ -99,7 +98,7 @@ fn expand_deriving(cx: ext_ctxt,
                    expand_deriving_struct_def: ExpandDerivingStructDefFn,
                    expand_deriving_enum_def: ExpandDerivingEnumDefFn)
                 -> ~[@item] {
-    let result = dvec::DVec();
+    let mut result = ~[];
     for in_items.each |item| {
         result.push(copy *item);
         match item.node {
@@ -120,7 +119,7 @@ fn expand_deriving(cx: ext_ctxt,
             _ => ()
         }
     }
-    dvec::unwrap(result)
+    result
 }
 
 fn create_impl_item(cx: ext_ctxt, span: span, +item: item_) -> @item {
@@ -202,14 +201,13 @@ fn create_self_type_with_params(cx: ext_ctxt,
                                 generics: &Generics)
                              -> @Ty {
     // Create the type parameters on the `self` path.
-    let self_ty_params = dvec::DVec();
+    let mut self_ty_params = ~[];
     for generics.ty_params.each |ty_param| {
         let self_ty_param = build::mk_simple_ty_path(cx,
                                                      span,
                                                      ty_param.ident);
         self_ty_params.push(self_ty_param);
     }
-    let self_ty_params = dvec::unwrap(self_ty_params);
 
     // Create the type of `self`.
     let self_type = build::mk_raw_path_(span,
@@ -433,7 +431,7 @@ fn create_subpatterns(cx: ext_ctxt,
                       prefix: ~str,
                       n: uint)
                    -> ~[@pat] {
-    let subpats = dvec::DVec();
+    let mut subpats = ~[];
     for uint::range(0, n) |_i| {
         // Create the subidentifier.
         let index = subpats.len().to_str();
@@ -445,7 +443,7 @@ fn create_subpatterns(cx: ext_ctxt,
         let subpat = build::mk_pat(cx, span, subpat);
         subpats.push(subpat);
     }
-    return dvec::unwrap(subpats);
+    return subpats;
 }
 
 fn is_struct_tuple(struct_def: &struct_def) -> bool {
@@ -809,7 +807,7 @@ fn expand_deriving_iter_bytes_struct_method(cx: ext_ctxt,
     let self_ident = cx.ident_of(~"self");
 
     // Create the body of the method.
-    let statements = dvec::DVec();
+    let mut statements = ~[];
     for struct_def.fields.each |struct_field| {
         match struct_field.node.kind {
             named_field(ident, _, _) => {
@@ -833,7 +831,6 @@ fn expand_deriving_iter_bytes_struct_method(cx: ext_ctxt,
     }
 
     // Create the method itself.
-    let statements = dvec::unwrap(statements);
     return create_iter_bytes_method(cx, span, statements);
 }
 
@@ -942,9 +939,9 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt,
     }
 
     // Create the arms of the self match in the method body.
-    let self_arms = dvec::DVec();
+    let mut self_arms = ~[];
     for enum_definition.variants.each |self_variant| {
-        let other_arms = dvec::DVec();
+        let mut other_arms = ~[];
 
         // Create the matching pattern.
         let matching_pat = create_enum_variant_pattern(cx,
@@ -1026,7 +1023,6 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt,
         // Create the self pattern body.
         let other_expr = build::mk_path(cx, span, ~[ other_ident ]);
         let other_expr = build::mk_unary(cx, span, deref, other_expr);
-        let other_arms = dvec::unwrap(other_arms);
         let other_match_expr = expr_match(other_expr, other_arms);
         let other_match_expr = build::mk_expr(cx,
                                               span,
@@ -1047,7 +1043,6 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt,
     // Create the method body.
     let self_expr = build::mk_path(cx, span, ~[ self_ident ]);
     let self_expr = build::mk_unary(cx, span, deref, self_expr);
-    let self_arms = dvec::unwrap(self_arms);
     let self_match_expr = expr_match(self_expr, self_arms);
     let self_match_expr = build::mk_expr(cx, span, self_match_expr);
 
@@ -1148,7 +1143,7 @@ fn expand_deriving_iter_bytes_enum_method(cx: ext_ctxt,
         }
 
         // Feed the discriminant to the byte iteration function.
-        let stmts = dvec::DVec();
+        let mut stmts = ~[];
         let discrim_stmt = call_substructure_iter_bytes_method(cx,
                                                                span,
                                                                discriminant);
@@ -1167,7 +1162,6 @@ fn expand_deriving_iter_bytes_enum_method(cx: ext_ctxt,
         }
 
         // Create the pattern body.
-        let stmts = dvec::unwrap(stmts);
         let match_body_block = build::mk_block_(cx, span, stmts);
 
         // Create the arm.
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index c66e726bbf7..88797a15206 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -19,8 +19,6 @@ use parse::parser::Parser;
 use parse::token::{Token, EOF, to_str, nonterminal};
 use parse::token;
 
-use core::dvec::DVec;
-use core::dvec;
 use core::option::{Option, Some, None};
 use core::str;
 use core::uint;
@@ -115,7 +113,7 @@ pub struct MatcherPos {
     sep: Option<Token>,
     idx: uint,
     up: matcher_pos_up, // mutable for swapping only
-    matches: ~[DVec<@named_match>],
+    matches: ~[~[@named_match]],
     match_lo: uint, match_hi: uint,
     sp_lo: BytePos,
 }
@@ -151,7 +149,7 @@ pub fn initial_matcher_pos(+ms: ~[matcher], +sep: Option<Token>, lo: BytePos)
           }
         }
     }
-    let matches = vec::from_fn(count_names(ms), |_i| dvec::DVec());
+    let matches = vec::from_fn(count_names(ms), |_i| ~[]);
     ~MatcherPos {
         elts: ms,
         sep: sep,
@@ -283,7 +281,7 @@ pub fn parse(
 
                         // Only touch the binders we have actually bound
                         for uint::range(ei.match_lo, ei.match_hi) |idx| {
-                            let sub = ei.matches[idx].get();
+                            let sub = ei.matches[idx];
                             new_pos.matches[idx]
                                 .push(@matched_seq(sub,
                                                    mk_sp(ei.sp_lo,
@@ -331,7 +329,7 @@ pub fn parse(
                     }
 
                     let matches = vec::map(ei.matches, // fresh, same size:
-                                           |_m| DVec::<@named_match>());
+                                           |_m| ~[]);
                     let ei_t = ei;
                     cur_eis.push(~MatcherPos {
                         elts: copy *matchers,
@@ -358,9 +356,11 @@ pub fn parse(
         /* error messages here could be improved with links to orig. rules */
         if tok == EOF {
             if eof_eis.len() == 1u {
-                return success(
-                    nameize(sess, ms,
-                            eof_eis[0u].matches.map(|dv| dv.pop())));
+                let mut v = ~[];
+                for vec::each_mut(eof_eis[0u].matches) |dv| {
+                    v.push(dv.pop());
+                }
+                return success(nameize(sess, ms, v));
             } else if eof_eis.len() > 1u {
                 return error(sp, ~"Ambiguity: multiple successful parses");
             } else {