about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-09-26 17:33:34 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-09-26 18:02:07 -0700
commit67a8e7128aea292445b763b47b04bc5f4fd43cb2 (patch)
tree9ddde322dbc8fd5af39e903419cae508d9df05f6 /src/libsyntax/ext
parentcd79e1d1b20a2c289dd15bc2766f97c789d975aa (diff)
downloadrust-67a8e7128aea292445b763b47b04bc5f4fd43cb2.tar.gz
rust-67a8e7128aea292445b763b47b04bc5f4fd43cb2.zip
Demode vec::push (and convert to method)
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/auto_serialize2.rs2
-rw-r--r--src/libsyntax/ext/base.rs2
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/fmt.rs4
-rw-r--r--src/libsyntax/ext/pipes/liveness.rs2
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs86
-rw-r--r--src/libsyntax/ext/simplext.rs13
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs24
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs4
9 files changed, 68 insertions, 71 deletions
diff --git a/src/libsyntax/ext/auto_serialize2.rs b/src/libsyntax/ext/auto_serialize2.rs
index 264711584fc..b51184eefd8 100644
--- a/src/libsyntax/ext/auto_serialize2.rs
+++ b/src/libsyntax/ext/auto_serialize2.rs
@@ -750,7 +750,7 @@ fn mk_enum_deser_body(
         body: cx.expr_blk(cx.expr(span, ast::expr_fail(None))),
     };
 
-    vec::push(arms, impossible_case);
+    arms.push(impossible_case);
 
     // ast for `|i| { match i { $(arms) } }`
     let expr_lambda = cx.expr(
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 1cbcd0f6ddb..566cdc4fa21 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -160,7 +160,7 @@ fn mk_ctxt(parse_sess: parse::parse_sess,
         fn cfg() -> ast::crate_cfg { self.cfg }
         fn print_backtrace() { }
         fn backtrace() -> expn_info { self.backtrace }
-        fn mod_push(i: ast::ident) { vec::push(self.mod_path, i); }
+        fn mod_push(i: ast::ident) { self.mod_path.push(i); }
         fn mod_pop() { vec::pop(self.mod_path); }
         fn mod_path() -> ~[ast::ident] { return self.mod_path; }
         fn bt_push(ei: codemap::expn_info_) {
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 8574c0c9082..8ce426f0357 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -96,7 +96,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};
-        vec::push(astfields, astfield);
+        astfields.push(astfield);
     }
     let recexpr = ast::expr_rec(astfields, option::None::<@ast::expr>);
     mk_expr(cx, sp, recexpr)
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 3ea0493239f..e4f197801c2 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -245,7 +245,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
     for pieces.each |pc| {
         match *pc {
           PieceString(s) => {
-            vec::push(piece_exprs, mk_uniq_str(cx, fmt_sp, s))
+            piece_exprs.push(mk_uniq_str(cx, fmt_sp, s))
           }
           PieceConv(conv) => {
             n += 1u;
@@ -258,7 +258,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
             log_conv(conv);
             let arg_expr = args[n];
             let c_expr = make_new_conv(cx, fmt_sp, conv, arg_expr);
-            vec::push(piece_exprs, c_expr);
+            piece_exprs.push(c_expr);
           }
         }
     }
diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs
index 8b17ffc1104..a9bfd87ab0e 100644
--- a/src/libsyntax/ext/pipes/liveness.rs
+++ b/src/libsyntax/ext/pipes/liveness.rs
@@ -65,7 +65,7 @@ fn analyze(proto: protocol, _cx: ext_ctxt) {
     let mut self_live = ~[];
     for colive.eachi |i, bv| {
         if bv.get(i) {
-            vec::push(self_live, proto.get_state_by_id(i))
+            self_live.push(proto.get_state_by_id(i))
         }
     }
 
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 11250cfbf38..f93fa830f92 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -226,7 +226,7 @@ impl state: to_type_decls {
 
             let v = cx.variant(cx.ident_of(name), span, tys);
 
-            vec::push(items_msg, v);
+            items_msg.push(v);
         }
 
         ~[cx.item_enum_poly(name,
@@ -245,44 +245,44 @@ impl state: to_type_decls {
         let mut items = ~[];
         for self.messages.each |m| {
             if dir == send {
-                vec::push(items, m.gen_send(cx, true));
-                vec::push(items, m.gen_send(cx, false));
+                items.push(m.gen_send(cx, true));
+                items.push(m.gen_send(cx, false));
             }
         }
 
         if !self.proto.is_bounded() {
-            vec::push(items,
-                      cx.item_ty_poly(
-                          self.data_name(),
-                          self.span,
-                          cx.ty_path_ast_builder(
-                              path(~[cx.ident_of(~"pipes"),
-                                     cx.ident_of(dir.to_str() + ~"Packet")],
-                                   empty_span())
-                              .add_ty(cx.ty_path_ast_builder(
-                                  path(~[cx.ident_of(self.proto.name),
-                                         self.data_name()],
-                                       empty_span())
-                                  .add_tys(cx.ty_vars(self.ty_params))))),
-                          self.ty_params));
+            items.push(
+                cx.item_ty_poly(
+                    self.data_name(),
+                    self.span,
+                    cx.ty_path_ast_builder(
+                        path(~[cx.ident_of(~"pipes"),
+                               cx.ident_of(dir.to_str() + ~"Packet")],
+                             empty_span())
+                        .add_ty(cx.ty_path_ast_builder(
+                            path(~[cx.ident_of(self.proto.name),
+                                   self.data_name()],
+                                 empty_span())
+                            .add_tys(cx.ty_vars(self.ty_params))))),
+                    self.ty_params));
         }
         else {
-            vec::push(items,
-                      cx.item_ty_poly(
-                          self.data_name(),
-                          self.span,
-                          cx.ty_path_ast_builder(
-                              path(~[cx.ident_of(~"pipes"),
-                                     cx.ident_of(dir.to_str()
-                                                 + ~"PacketBuffered")],
-                                  empty_span())
-                              .add_tys(~[cx.ty_path_ast_builder(
-                                  path(~[cx.ident_of(self.proto.name),
-                                         self.data_name()],
-                                       empty_span())
-                                  .add_tys(cx.ty_vars(self.ty_params))),
-                                         self.proto.buffer_ty_path(cx)])),
-                          self.ty_params));
+            items.push(
+                cx.item_ty_poly(
+                    self.data_name(),
+                    self.span,
+                    cx.ty_path_ast_builder(
+                        path(~[cx.ident_of(~"pipes"),
+                               cx.ident_of(dir.to_str()
+                                           + ~"PacketBuffered")],
+                             empty_span())
+                        .add_tys(~[cx.ty_path_ast_builder(
+                            path(~[cx.ident_of(self.proto.name),
+                                   self.data_name()],
+                                 empty_span())
+                            .add_tys(cx.ty_vars(self.ty_params))),
+                                   self.proto.buffer_ty_path(cx)])),
+                    self.ty_params));
         };
         items
     }
@@ -367,7 +367,7 @@ impl protocol: gen_init {
         for (copy self.states).each |s| {
             for s.ty_params.each |tp| {
                 match params.find(|tpp| tp.ident == tpp.ident) {
-                  None => vec::push(params, *tp),
+                  None => params.push(*tp),
                   _ => ()
                 }
             }
@@ -383,7 +383,7 @@ impl protocol: gen_init {
         let fields = do (copy self.states).map_to_vec |s| {
             for s.ty_params.each |tp| {
                 match params.find(|tpp| tp.ident == tpp.ident) {
-                  None => vec::push(params, *tp),
+                  None => params.push(*tp),
                   _ => ()
                 }
             }
@@ -415,17 +415,15 @@ impl protocol: gen_init {
         }
 
         if self.is_bounded() {
-            vec::push(items, self.gen_buffer_type(cx))
+            items.push(self.gen_buffer_type(cx))
         }
 
-        vec::push(items,
-                  cx.item_mod(cx.ident_of(~"client"),
-                              self.span,
-                              client_states));
-        vec::push(items,
-                  cx.item_mod(cx.ident_of(~"server"),
-                              self.span,
-                              server_states));
+        items.push(cx.item_mod(cx.ident_of(~"client"),
+                               self.span,
+                               client_states));
+        items.push(cx.item_mod(cx.ident_of(~"server"),
+                               self.span,
+                               server_states));
 
         cx.item_mod(cx.ident_of(self.name), self.span, items)
     }
diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs
index 4729e7da39c..51239754635 100644
--- a/src/libsyntax/ext/simplext.rs
+++ b/src/libsyntax/ext/simplext.rs
@@ -94,7 +94,7 @@ fn option_flatten_map<T: Copy, U: Copy>(f: fn@(T) -> Option<U>, v: ~[T]) ->
     for v.each |elem| {
         match f(*elem) {
           None => return None,
-          Some(fv) => vec::push(res, fv)
+          Some(fv) => res.push(fv)
         }
     }
     return Some(res);
@@ -305,8 +305,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 {
-                    vec::push(*idx_path, idx);
-                    vec::push(res, recur(repeat_me)); // whew!
+                    idx_path.push(idx);
+                    res.push(recur(repeat_me)); // whew!
                     vec::pop(*idx_path);
                     idx += 1u;
                 }
@@ -567,7 +567,7 @@ fn p_t_s_r_ellipses(cx: ext_ctxt, repeat_me: @expr, offset: uint, s: selector,
                     let mut elts = ~[];
                     let mut idx = offset;
                     while idx < vec::len(arg_elts) {
-                        vec::push(elts, leaf(match_expr(arg_elts[idx])));
+                        elts.push(leaf(match_expr(arg_elts[idx])));
                         idx += 1u;
                     }
 
@@ -672,9 +672,8 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
                       None => cx.span_fatal(mac.span,
                                            ~"macro must have arguments")
                     };
-                    vec::push(clauses,
-                              @{params: pattern_to_selectors(cx, arg),
-                                body: elts[1u]});
+                    clauses.push(@{params: pattern_to_selectors(cx, arg),
+                                   body: elts[1u]});
 
                     // FIXME (#2251): check duplicates (or just simplify
                     // the macro arg situation)
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index a7a45942822..737694337e3 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -208,7 +208,7 @@ fn parse_or_else(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
 fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
     -> parse_result {
     let mut cur_eis = ~[];
-    vec::push(cur_eis, initial_matcher_pos(ms, None, rdr.peek().sp.lo));
+    cur_eis.push(initial_matcher_pos(ms, None, rdr.peek().sp.lo));
 
     loop {
         let mut bb_eis = ~[]; // black-box parsed by parser.rs
@@ -256,7 +256,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                         }
 
                         new_pos.idx += 1;
-                        vec::push(cur_eis, move new_pos);
+                        cur_eis.push(move new_pos);
                     }
 
                     // can we go around again?
@@ -267,17 +267,17 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                         if tok == t { //pass the separator
                             let ei_t <- ei;
                             ei_t.idx += 1;
-                            vec::push(next_eis, move ei_t);
+                            next_eis.push(move ei_t);
                         }
                       }
                       _ => { // we don't need a separator
                         let ei_t <- ei;
                         ei_t.idx = 0;
-                        vec::push(cur_eis, move ei_t);
+                        cur_eis.push(move ei_t);
                       }
                     }
                 } else {
-                    vec::push(eof_eis, move ei);
+                    eof_eis.push(move ei);
                 }
             } else {
                 match copy ei.elts[idx].node {
@@ -292,13 +292,13 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                             new_ei.matches[idx].push(@matched_seq(~[], sp));
                         }
 
-                        vec::push(cur_eis, move new_ei);
+                        cur_eis.push(move new_ei);
                     }
 
                     let matches = vec::map(ei.matches, // fresh, same size:
                                            |_m| DVec::<@named_match>());
                     let ei_t <- ei;
-                    vec::push(cur_eis, ~{
+                    cur_eis.push(~{
                         elts: matchers, sep: sep, mut idx: 0u,
                         mut up: matcher_pos_up(Some(move ei_t)),
                         matches: move matches,
@@ -306,12 +306,12 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                         sp_lo: sp.lo
                     });
                   }
-                  match_nonterminal(_,_,_) => { vec::push(bb_eis, move ei) }
+                  match_nonterminal(_,_,_) => { bb_eis.push(move ei) }
                   match_tok(t) => {
                     let ei_t <- ei;
                     if t == tok {
                         ei_t.idx += 1;
-                        vec::push(next_eis, move ei_t);
+                        next_eis.push(move ei_t);
                     }
                   }
                 }
@@ -323,7 +323,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
             if eof_eis.len() == 1u {
                 return success(
                     nameize(sess, ms,
-                            vec::map(eof_eis[0u].matches, |dv| dv.pop())));
+                            eof_eis[0u].matches.map(|dv| dv.pop())));
             } else if eof_eis.len() > 1u {
                 return error(sp, ~"Ambiguity: multiple successful parses");
             } else {
@@ -350,7 +350,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
             } else if (next_eis.len() > 0u) {
                 /* Now process the next token */
                 while(next_eis.len() > 0u) {
-                    vec::push(cur_eis, vec::pop(next_eis));
+                    cur_eis.push(vec::pop(next_eis));
                 }
                 rdr.next_token();
             } else /* bb_eis.len() == 1 */ {
@@ -365,7 +365,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                   }
                   _ => fail
                 }
-                vec::push(cur_eis, move ei);
+                cur_eis.push(move ei);
 
                 /* this would fail if zero-length tokens existed */
                 while rdr.peek().sp.lo < rust_parser.span.lo {
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index b208e4f8c6f..558593579bf 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -205,8 +205,8 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
                     r.cur.idx += 1u;
                     return tt_next_token(r);
                 } else {
-                    vec::push(r.repeat_len, len);
-                    vec::push(r.repeat_idx, 0u);
+                    r.repeat_len.push(len);
+                    r.repeat_idx.push(0u);
                     r.cur = @{readme: tts, mut idx: 0u, dotdotdoted: true,
                               sep: sep, up: tt_frame_up(option::Some(r.cur))};
                 }