about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorEric Holk <eric.holk@gmail.com>2012-06-27 23:09:51 -0700
committerEric Holk <eric.holk@gmail.com>2012-06-27 23:09:51 -0700
commitae06546bbf72ed9eb8bf4086eaccf67703bf84ef (patch)
tree017518fabfda8abf92c61ba03872d6a39f735ec8 /src/libsyntax/ext
parent0b84437b68f4b54e05eb4639230c46b925abf902 (diff)
downloadrust-ae06546bbf72ed9eb8bf4086eaccf67703bf84ef.tar.gz
rust-ae06546bbf72ed9eb8bf4086eaccf67703bf84ef.zip
Replace more vector + (issue #2719)
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/auto_serialize.rs56
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/fmt.rs2
-rw-r--r--src/libsyntax/ext/simplext.rs14
4 files changed, 40 insertions, 34 deletions
diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs
index f3c356923f2..06fb6b94f6e 100644
--- a/src/libsyntax/ext/auto_serialize.rs
+++ b/src/libsyntax/ext/auto_serialize.rs
@@ -103,12 +103,14 @@ fn expand(cx: ext_ctxt,
     vec::flat_map(in_items) {|in_item|
         alt in_item.node {
           ast::item_ty(ty, tps, _) {
-            [filter_attrs(in_item)]/~ + ty_fns(cx, in_item.ident, ty, tps)
+            vec::append([filter_attrs(in_item)]/~,
+                        ty_fns(cx, in_item.ident, ty, tps))
           }
 
           ast::item_enum(variants, tps, _) {
-            [filter_attrs(in_item)]/~ + enum_fns(cx, in_item.ident,
-                                               in_item.span, variants, tps)
+            vec::append([filter_attrs(in_item)]/~,
+                        enum_fns(cx, in_item.ident,
+                                 in_item.span, variants, tps))
           }
 
           _ {
@@ -126,7 +128,8 @@ impl helpers for ext_ctxt {
                    helper_name: str) -> @ast::path {
         let head = vec::init(base_path.idents);
         let tail = vec::last(base_path.idents);
-        self.path(base_path.span, head + [@(helper_name + "_" + *tail)]/~)
+        self.path(base_path.span,
+                  vec::append(head, [@(helper_name + "_" + *tail)]/~))
     }
 
     fn path(span: span, strs: [ast::ident]/~) -> @ast::path {
@@ -301,7 +304,7 @@ fn ser_path(cx: ext_ctxt, tps: ser_tps_map, path: @ast::path,
     [cx.stmt(
         cx.expr(
             path.span,
-            ast::expr_call(callee, [s, v]/~ + ty_args, false)))]/~
+            ast::expr_call(callee, vec::append([s, v]/~, ty_args), false)))]/~
 }
 
 fn ser_variant(cx: ext_ctxt,
@@ -502,15 +505,15 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident,
 
 
     let ser_inputs: [ast::arg]/~ =
-        [{mode: ast::expl(ast::by_ref),
-          ty: cx.ty_path(span, [@"__S"]/~, []/~),
-          ident: @"__s",
-          id: cx.next_id()},
-         {mode: ast::expl(ast::by_ref),
-          ty: v_ty,
-          ident: @"__v",
-          id: cx.next_id()}]/~
-        + tp_inputs;
+        vec::append([{mode: ast::expl(ast::by_ref),
+                      ty: cx.ty_path(span, [@"__S"]/~, []/~),
+                      ident: @"__s",
+                      id: cx.next_id()},
+                     {mode: ast::expl(ast::by_ref),
+                      ty: v_ty,
+                      ident: @"__v",
+                      id: cx.next_id()}]/~,
+                    tp_inputs);
 
     let tps_map = map::str_hash();
     vec::iter2(tps, tp_inputs) {|tp, arg|
@@ -531,10 +534,10 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident,
                                     []/~))]/~;
 
     let ser_tps: [ast::ty_param]/~ =
-        [{ident: @"__S",
-          id: cx.next_id(),
-          bounds: ser_bnds}]/~ +
-        vec::map(tps) {|tp| cx.clone_ty_param(tp) };
+        vec::append([{ident: @"__S",
+                      id: cx.next_id(),
+                      bounds: ser_bnds}]/~,
+                    vec::map(tps) {|tp| cx.clone_ty_param(tp) });
 
     let ser_output: @ast::ty = @{id: cx.next_id(),
                                  node: ast::ty_nil,
@@ -575,7 +578,8 @@ fn deser_path(cx: ext_ctxt, tps: deser_tps_map, path: @ast::path,
         cx.lambda(cx.expr_blk(dv_expr))
     };
 
-    cx.expr(path.span, ast::expr_call(callee, [d]/~ + ty_args, false))
+    cx.expr(path.span, ast::expr_call(callee, vec::append([d]/~, ty_args),
+                                      false))
 }
 
 fn deser_lambda(cx: ext_ctxt, tps: deser_tps_map, ty: @ast::ty,
@@ -712,11 +716,11 @@ fn mk_deser_fn(cx: ext_ctxt, span: span,
     #debug["tp_inputs = %?", tp_inputs];
 
     let deser_inputs: [ast::arg]/~ =
-        [{mode: ast::expl(ast::by_ref),
-          ty: cx.ty_path(span, [@"__D"]/~, []/~),
-          ident: @"__d",
-          id: cx.next_id()}]/~
-        + tp_inputs;
+        vec::append([{mode: ast::expl(ast::by_ref),
+                      ty: cx.ty_path(span, [@"__D"]/~, []/~),
+                      ident: @"__d",
+                      id: cx.next_id()}]/~,
+                    tp_inputs);
 
     let tps_map = map::str_hash();
     vec::iter2(tps, tp_inputs) {|tp, arg|
@@ -740,7 +744,9 @@ fn mk_deser_fn(cx: ext_ctxt, span: span,
           id: cx.next_id(),
           bounds: deser_bnds}]/~ + vec::map(tps) {|tp|
         let cloned = cx.clone_ty_param(tp);
-        {bounds: @(*cloned.bounds + [ast::bound_copy]/~) with cloned}
+        {bounds: @(vec::append(*cloned.bounds,
+                               [ast::bound_copy]/~))
+         with cloned}
     };
 
     let deser_blk = cx.expr_blk(f(cx, tps_map, #ast(expr){__d}));
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index adb0b26e646..13b5d9cbc18 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -82,7 +82,7 @@ fn mk_rec_e(cx: ext_ctxt, sp: span,
         let val = field.ex;
         let astfield =
             {node: {mutbl: ast::m_imm, ident: ident, expr: val}, span: sp};
-        astfields += [astfield]/~;
+        vec::push(astfields, astfield);
     }
     let recexpr = ast::expr_rec(astfields, option::none::<@ast::expr>);
     ret @{id: cx.next_id(), node: recexpr, span: sp};
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 43408dec739..c324455e6cc 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -60,7 +60,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
                   flag_sign_always { fstr = "flag_sign_always"; }
                   flag_alternate { fstr = "flag_alternate"; }
                 }
-                flagexprs += [make_rt_path_expr(cx, sp, @fstr)]/~;
+                vec::push(flagexprs, make_rt_path_expr(cx, sp, @fstr));
             }
             ret mk_uniq_vec_e(cx, sp, flagexprs);
         }
diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs
index c29b2246993..dedd95551f2 100644
--- a/src/libsyntax/ext/simplext.rs
+++ b/src/libsyntax/ext/simplext.rs
@@ -104,7 +104,7 @@ fn option_flatten_map<T: copy, U: copy>(f: fn@(T) -> option<U>, v: [T]/~) ->
    option<[U]/~> {
     let mut res = []/~;
     for v.each {|elem|
-        alt f(elem) { none { ret none; } some(fv) { res += [fv]/~; } }
+        alt f(elem) { none { ret none; } some(fv) { vec::push(res, fv); } }
     }
     ret some(res);
 }
@@ -309,8 +309,8 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut [uint]/~,
                 /* Whew, we now know how how many times to repeat */
                 let mut idx: uint = 0u;
                 while idx < rc {
-                    *idx_path += [idx]/~;
-                    res += [recur(repeat_me)]/~; // whew!
+                    vec::push(*idx_path, idx);
+                    vec::push(res, recur(repeat_me)); // whew!
                     vec::pop(*idx_path);
                     idx += 1u;
                 }
@@ -318,7 +318,7 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut [uint]/~,
             }
           }
         }
-        res += vec::map(post, recur);
+        res = vec::append(res, vec::map(post, recur));
         ret res;
       }
     }
@@ -718,9 +718,9 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
                       none { cx.span_fatal(mac.span,
                                            "macro must have arguments")}
                     };
-                    clauses +=
-                        [@{params: pattern_to_selectors(cx, arg),
-                           body: elts[1u]}]/~;
+                    vec::push(clauses,
+                              @{params: pattern_to_selectors(cx, arg),
+                                body: elts[1u]});
 
                     // FIXME (#2251): check duplicates (or just simplify
                     // the macro arg situation)