]> git.lizzy.rs Git - rust.git/commitdiff
Stop using @ExtCtxt
authorSteven Fackler <sfackler@gmail.com>
Sat, 28 Dec 2013 00:17:36 +0000 (17:17 -0700)
committerSteven Fackler <sfackler@gmail.com>
Sun, 29 Dec 2013 04:16:03 +0000 (21:16 -0700)
35 files changed:
src/librustc/front/test.rs
src/librustpkg/util.rs
src/libsyntax/ext/asm.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/bytes.rs
src/libsyntax/ext/cfg.rs
src/libsyntax/ext/concat.rs
src/libsyntax/ext/concat_idents.rs
src/libsyntax/ext/deriving/clone.rs
src/libsyntax/ext/deriving/cmp/eq.rs
src/libsyntax/ext/deriving/cmp/ord.rs
src/libsyntax/ext/deriving/cmp/totaleq.rs
src/libsyntax/ext/deriving/cmp/totalord.rs
src/libsyntax/ext/deriving/decodable.rs
src/libsyntax/ext/deriving/default.rs
src/libsyntax/ext/deriving/encodable.rs
src/libsyntax/ext/deriving/generic.rs
src/libsyntax/ext/deriving/iter_bytes.rs
src/libsyntax/ext/deriving/mod.rs
src/libsyntax/ext/deriving/primitive.rs
src/libsyntax/ext/deriving/rand.rs
src/libsyntax/ext/deriving/to_str.rs
src/libsyntax/ext/deriving/ty.rs
src/libsyntax/ext/deriving/zero.rs
src/libsyntax/ext/env.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/fmt.rs
src/libsyntax/ext/format.rs
src/libsyntax/ext/log_syntax.rs
src/libsyntax/ext/quote.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/ext/trace_macros.rs
src/libsyntax/ext/tt/macro_rules.rs
src/test/run-pass-fulldeps/quote-tokens.rs

index 47ef4b94058ba1cc32157c3d5753fee2f83dbf00..ed899561bc9198d94cb554a33f552cdd6d1c7c78 100644 (file)
@@ -40,7 +40,7 @@ struct Test {
 struct TestCtxt {
     sess: session::Session,
     path: RefCell<~[ast::Ident]>,
-    ext_cx: @ExtCtxt,
+    ext_cx: ExtCtxt,
     testfns: RefCell<~[Test]>,
     is_extra: bool,
     config: ast::CrateConfig,
@@ -163,8 +163,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
         config: crate.config.clone(),
     };
 
-    let ext_cx = cx.ext_cx;
-    ext_cx.bt_push(ExpnInfo {
+    cx.ext_cx.bt_push(ExpnInfo {
         call_site: dummy_sp(),
         callee: NameAndSpan {
             name: @"test",
@@ -177,7 +176,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
         cx: cx
     };
     let res = fold.fold_crate(crate);
-    ext_cx.bt_pop();
+    cx.ext_cx.bt_pop();
     return res;
 }
 
@@ -313,7 +312,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item {
 
     // The synthesized main function which will call the console test runner
     // with our list of tests
-    let mainfn = (quote_item!(cx.ext_cx,
+    let mainfn = (quote_item!(&cx.ext_cx,
         pub fn main() {
             #[main];
             extra::test::test_main_static(::std::os::args(), TESTS);
@@ -377,7 +376,7 @@ fn mk_tests(cx: &TestCtxt) -> @ast::item {
     // The vector of test_descs for this crate
     let test_descs = mk_test_descs(cx);
 
-    (quote_item!(cx.ext_cx,
+    (quote_item!(&cx.ext_cx,
         pub static TESTS : &'static [self::extra::test::TestDescAndFn] =
             $test_descs
         ;
@@ -438,24 +437,24 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr {
     };
 
     let t_expr = if test.bench {
-        quote_expr!(cx.ext_cx, self::extra::test::StaticBenchFn($fn_expr) )
+        quote_expr!(&cx.ext_cx, self::extra::test::StaticBenchFn($fn_expr) )
     } else {
-        quote_expr!(cx.ext_cx, self::extra::test::StaticTestFn($fn_expr) )
+        quote_expr!(&cx.ext_cx, self::extra::test::StaticTestFn($fn_expr) )
     };
 
     let ignore_expr = if test.ignore {
-        quote_expr!(cx.ext_cx, true )
+        quote_expr!(&cx.ext_cx, true )
     } else {
-        quote_expr!(cx.ext_cx, false )
+        quote_expr!(&cx.ext_cx, false )
     };
 
     let fail_expr = if test.should_fail {
-        quote_expr!(cx.ext_cx, true )
+        quote_expr!(&cx.ext_cx, true )
     } else {
-        quote_expr!(cx.ext_cx, false )
+        quote_expr!(&cx.ext_cx, false )
     };
 
-    let e = quote_expr!(cx.ext_cx,
+    let e = quote_expr!(&cx.ext_cx,
         self::extra::test::TestDescAndFn {
             desc: self::extra::test::TestDesc {
                 name: self::extra::test::StaticTestName($name_expr),
index eb7dbe4e4a8a73fb6c5f595c538dba78734d6c44..b8d01f56e4db577bddb1dfffb63c58e24423e7a3 100644 (file)
@@ -75,7 +75,7 @@ struct ListenerFn {
 
 struct ReadyCtx {
     sess: session::Session,
-    ext_cx: @ExtCtxt,
+    ext_cx: ExtCtxt,
     path: ~[ast::Ident],
     fns: ~[ListenerFn]
 }
index f4b1c7f1f06df811bd62b7adea98030387d20525..fdde336ffa724e8b36de6070e865622c7183b892 100644 (file)
@@ -37,7 +37,7 @@ fn next_state(s: State) -> Option<State> {
     }
 }
 
-pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_asm(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
                -> base::MacResult {
     let p = parse::new_parser_from_tts(cx.parse_sess(),
                                        cx.cfg(),
index d5a64a5edbaea5cb2ba1c78dd8bf9b40dfbc07df..87d09ea3f8ed819beca280b307df6df979e8deda 100644 (file)
@@ -35,7 +35,7 @@ pub struct MacroDef {
     ext: SyntaxExtension
 }
 
-pub type ItemDecorator = extern "Rust" fn(@ExtCtxt,
+pub type ItemDecorator = extern "Rust" fn(&ExtCtxt,
                                           Span,
                                           @ast::MetaItem,
                                           ~[@ast::item])
@@ -48,7 +48,7 @@ pub struct SyntaxExpanderTT {
 
 pub trait SyntaxExpanderTTTrait {
     fn expand(&self,
-              ecx: @ExtCtxt,
+              ecx: &ExtCtxt,
               span: Span,
               token_tree: &[ast::token_tree],
               context: ast::SyntaxContext)
@@ -56,7 +56,7 @@ fn expand(&self,
 }
 
 pub type SyntaxExpanderTTFunNoCtxt =
-    extern "Rust" fn(ecx: @ExtCtxt,
+    extern "Rust" fn(ecx: &ExtCtxt,
                      span: codemap::Span,
                      token_tree: &[ast::token_tree])
                      -> MacResult;
@@ -67,7 +67,7 @@ enum SyntaxExpanderTTExpander {
 
 impl SyntaxExpanderTTTrait for SyntaxExpanderTT {
     fn expand(&self,
-              ecx: @ExtCtxt,
+              ecx: &ExtCtxt,
               span: Span,
               token_tree: &[ast::token_tree],
               _: ast::SyntaxContext)
@@ -92,7 +92,7 @@ pub struct SyntaxExpanderTTItem {
 
 pub trait SyntaxExpanderTTItemTrait {
     fn expand(&self,
-              cx: @ExtCtxt,
+              cx: &ExtCtxt,
               sp: Span,
               ident: ast::Ident,
               token_tree: ~[ast::token_tree],
@@ -102,7 +102,7 @@ fn expand(&self,
 
 impl SyntaxExpanderTTItemTrait for SyntaxExpanderTTItem {
     fn expand(&self,
-              cx: @ExtCtxt,
+              cx: &ExtCtxt,
               sp: Span,
               ident: ast::Ident,
               token_tree: ~[ast::token_tree],
@@ -119,7 +119,7 @@ fn expand(&self,
     }
 }
 
-pub type SyntaxExpanderTTItemFun = extern "Rust" fn(@ExtCtxt,
+pub type SyntaxExpanderTTItemFun = extern "Rust" fn(&ExtCtxt,
                                                     Span,
                                                     ast::Ident,
                                                     ~[ast::token_tree],
@@ -127,7 +127,7 @@ fn expand(&self,
                                                     -> MacResult;
 
 pub type SyntaxExpanderTTItemFunNoCtxt =
-    extern "Rust" fn(@ExtCtxt, Span, ast::Ident, ~[ast::token_tree])
+    extern "Rust" fn(&ExtCtxt, Span, ast::Ident, ~[ast::token_tree])
                      -> MacResult;
 
 pub trait AnyMacro {
@@ -319,8 +319,8 @@ pub struct ExtCtxt {
 
 impl ExtCtxt {
     pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::CrateConfig)
-               -> @ExtCtxt {
-        @ExtCtxt {
+               -> ExtCtxt {
+        ExtCtxt {
             parse_sess: parse_sess,
             cfg: cfg,
             backtrace: @mut None,
@@ -329,7 +329,7 @@ pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::CrateConfig)
         }
     }
 
-    pub fn expand_expr(@self, mut e: @ast::Expr) -> @ast::Expr {
+    pub fn expand_expr(&self, mut e: @ast::Expr) -> @ast::Expr {
         loop {
             match e.node {
                 ast::ExprMac(..) => {
@@ -417,7 +417,7 @@ pub fn ident_of(&self, st: &str) -> ast::Ident {
     }
 }
 
-pub fn expr_to_str(cx: @ExtCtxt, expr: @ast::Expr, err_msg: &str) -> (@str, ast::StrStyle) {
+pub fn expr_to_str(cx: &ExtCtxt, expr: @ast::Expr, err_msg: &str) -> (@str, ast::StrStyle) {
     match expr.node {
       ast::ExprLit(l) => match l.node {
         ast::lit_str(s, style) => (s, style),
@@ -427,14 +427,14 @@ pub fn expr_to_str(cx: @ExtCtxt, expr: @ast::Expr, err_msg: &str) -> (@str, ast:
     }
 }
 
-pub fn check_zero_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree],
+pub fn check_zero_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree],
                       name: &str) {
     if tts.len() != 0 {
         cx.span_fatal(sp, format!("{} takes no arguments", name));
     }
 }
 
-pub fn get_single_str_from_tts(cx: @ExtCtxt,
+pub fn get_single_str_from_tts(cx: &ExtCtxt,
                                sp: Span,
                                tts: &[ast::token_tree],
                                name: &str)
@@ -450,7 +450,7 @@ pub fn get_single_str_from_tts(cx: @ExtCtxt,
     }
 }
 
-pub fn get_exprs_from_tts(cx: @ExtCtxt,
+pub fn get_exprs_from_tts(cx: &ExtCtxt,
                           sp: Span,
                           tts: &[ast::token_tree]) -> ~[@ast::Expr] {
     let p = parse::new_parser_from_tts(cx.parse_sess(),
index aa7e0d0eced8d3877618ae19fdc3d6b474a2d498..007c06938c60edbd2b636cabe676e123f8e1089a 100644 (file)
@@ -15,7 +15,7 @@
 use codemap::{Span, respan, dummy_sp};
 use ext::base::ExtCtxt;
 use ext::quote::rt::*;
-use fold;
+use fold::ast_fold;
 use opt_vec;
 use opt_vec::OptVec;
 
@@ -236,7 +236,7 @@ fn view_use_glob(&self, sp: Span,
                      vis: ast::visibility, path: ~[ast::Ident]) -> ast::view_item;
 }
 
-impl AstBuilder for @ExtCtxt {
+impl<'a> AstBuilder for &'a ExtCtxt {
     fn path(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path {
         self.path_all(span, false, strs, opt_vec::Empty, ~[])
     }
@@ -903,11 +903,11 @@ fn view_use_glob(&self, sp: Span,
     }
 }
 
-struct Duplicator {
-    cx: @ExtCtxt,
+struct Duplicator<'a> {
+    cx: &'a ExtCtxt,
 }
 
-impl fold::ast_fold for Duplicator {
+impl<'a> ast_fold for Duplicator<'a> {
     fn new_id(&self, _: NodeId) -> NodeId {
         ast::DUMMY_NODE_ID
     }
@@ -920,14 +920,14 @@ pub trait Duplicate {
     // These functions just duplicate AST nodes.
     //
 
-    fn duplicate(&self, cx: @ExtCtxt) -> Self;
+    fn duplicate(&self, cx: &ExtCtxt) -> Self;
 }
 
 impl Duplicate for @ast::Expr {
-    fn duplicate(&self, cx: @ExtCtxt) -> @ast::Expr {
-        let folder = @Duplicator {
+    fn duplicate(&self, cx: &ExtCtxt) -> @ast::Expr {
+        let folder = Duplicator {
             cx: cx,
-        } as @fold::ast_fold;
+        };
         folder.fold_expr(*self)
     }
 }
index 933f4b33fe3df3a75ff7fd81a053df4ec5703876..1ceb2a1668eaf677f3fa9cc39388facd7c05dce2 100644 (file)
@@ -18,7 +18,7 @@
 
 use std::char;
 
-pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult {
+pub fn expand_syntax_ext(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult {
     // Gather all argument expressions
     let exprs = get_exprs_from_tts(cx, sp, tts);
     let mut bytes = ~[];
index 89e7994530d737535ae2a93ea056a09d469d410c..2ca8917ed8fc6c4c69e2e081c0e985628649b8e6 100644 (file)
@@ -25,7 +25,7 @@
 use parse::token;
 use parse::attr::parser_attr;
 
-pub fn expand_cfg(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult {
+pub fn expand_cfg(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult {
     let p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.to_owned());
 
     let mut cfgs = ~[];
index 11e316e3e6bd65fd4df630b67180eaa572d6073e..b6a81a8bea5435f2cf57aef92ad6a2300abab579 100644 (file)
@@ -15,7 +15,7 @@
 use ext::base;
 use ext::build::AstBuilder;
 
-pub fn expand_syntax_ext(cx: @base::ExtCtxt,
+pub fn expand_syntax_ext(cx: &base::ExtCtxt,
                          sp: codemap::Span,
                          tts: &[ast::token_tree]) -> base::MacResult {
     let es = base::get_exprs_from_tts(cx, sp, tts);
index 216bc3097ce9402ef86150ac0f6c3e32a62ea538..6b204a243cb1e612dc41720a520be9b1e0e01f52 100644 (file)
@@ -16,7 +16,7 @@
 use parse::token;
 use parse::token::{str_to_ident};
 
-pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_syntax_ext(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     let mut res_str = ~"";
     for (i, e) in tts.iter().enumerate() {
index 9285defe69ea11db1b80a1318ded48f9b3aef7a3..c3c57082684b65f9755ead8c7944cde743acc659 100644 (file)
@@ -14,7 +14,7 @@
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_clone(cx: @ExtCtxt,
+pub fn expand_deriving_clone(cx: &ExtCtxt,
                              span: Span,
                              mitem: @MetaItem,
                              in_items: ~[@item])
@@ -42,7 +42,7 @@ pub fn expand_deriving_clone(cx: @ExtCtxt,
     trait_def.expand(mitem, in_items)
 }
 
-pub fn expand_deriving_deep_clone(cx: @ExtCtxt,
+pub fn expand_deriving_deep_clone(cx: &ExtCtxt,
                                   span: Span,
                                   mitem: @MetaItem,
                                   in_items: ~[@item])
@@ -74,7 +74,7 @@ pub fn expand_deriving_deep_clone(cx: @ExtCtxt,
 
 fn cs_clone(
     name: &str,
-    cx: @ExtCtxt, span: Span,
+    cx: &ExtCtxt, span: Span,
     substr: &Substructure) -> @Expr {
     let clone_ident = substr.method_ident;
     let ctor_ident;
index 74680266cb709c29ef2156b085db21dfee6b0b77..f7b249fc8d8bb50da211e3644b13d532ddd6e6b5 100644 (file)
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_eq(cx: @ExtCtxt,
+pub fn expand_deriving_eq(cx: &ExtCtxt,
                           span: Span,
                           mitem: @MetaItem,
                           in_items: ~[@item]) -> ~[@item] {
     // structures are equal if all fields are equal, and non equal, if
     // any fields are not equal or if the enum variants are different
-    fn cs_eq(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+    fn cs_eq(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
         cs_and(|cx, span, _, _| cx.expr_bool(span, false),
                                  cx, span, substr)
     }
-    fn cs_ne(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+    fn cs_ne(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
         cs_or(|cx, span, _, _| cx.expr_bool(span, true),
               cx, span, substr)
     }
index d48cfbd7dd70787e671049f7a13be5dcf0cab3db..c1e4e1e2b641d8b6028bf1fe1801622c693a38c8 100644 (file)
@@ -15,7 +15,7 @@
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_ord(cx: @ExtCtxt,
+pub fn expand_deriving_ord(cx: &ExtCtxt,
                            span: Span,
                            mitem: @MetaItem,
                            in_items: ~[@item]) -> ~[@item] {
@@ -51,7 +51,7 @@ macro_rules! md (
 }
 
 /// Strict inequality.
-fn cs_op(less: bool, equal: bool, cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+fn cs_op(less: bool, equal: bool, cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
     let op = if less {ast::BiLt} else {ast::BiGt};
     cs_fold(
         false, // need foldr,
index ab822d14b484519e73998a3fc64d2967bc3b719e..0b4d2659fd1fe6f6ab6095fc507db041e9254a60 100644 (file)
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_totaleq(cx: @ExtCtxt,
+pub fn expand_deriving_totaleq(cx: &ExtCtxt,
                                span: Span,
                                mitem: @MetaItem,
                                in_items: ~[@item]) -> ~[@item] {
-    fn cs_equals(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+    fn cs_equals(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
         cs_and(|cx, span, _, _| cx.expr_bool(span, false),
                cx, span, substr)
     }
index 2ace39a3486885221b6544ab5d1e7d04068882ef..3c58bfa01a96fa4a39d5f8fd271fb7ac73f9b295 100644 (file)
@@ -16,7 +16,7 @@
 use ext::deriving::generic::*;
 use std::cmp::{Ordering, Equal, Less, Greater};
 
-pub fn expand_deriving_totalord(cx: @ExtCtxt,
+pub fn expand_deriving_totalord(cx: &ExtCtxt,
                                 span: Span,
                                 mitem: @MetaItem,
                                 in_items: ~[@item]) -> ~[@item] {
@@ -44,7 +44,7 @@ pub fn expand_deriving_totalord(cx: @ExtCtxt,
 }
 
 
-pub fn ordering_const(cx: @ExtCtxt, span: Span, cnst: Ordering) -> ast::Path {
+pub fn ordering_const(cx: &ExtCtxt, span: Span, cnst: Ordering) -> ast::Path {
     let cnst = match cnst {
         Less => "Less",
         Equal => "Equal",
@@ -56,7 +56,7 @@ pub fn ordering_const(cx: @ExtCtxt, span: Span, cnst: Ordering) -> ast::Path {
                      cx.ident_of(cnst)])
 }
 
-pub fn cs_cmp(cx: @ExtCtxt, span: Span,
+pub fn cs_cmp(cx: &ExtCtxt, span: Span,
               substr: &Substructure) -> @Expr {
     let test_id = cx.ident_of("__test");
     let equals_path = ordering_const(cx, span, Equal);
index 0aade760b7ba689e4f9b9dd8fe52488e5d2a9647..de995af9ae3a5c56faa4f1e6bb0ea9f71891a169 100644 (file)
@@ -19,7 +19,7 @@
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_decodable(cx: @ExtCtxt,
+pub fn expand_deriving_decodable(cx: &ExtCtxt,
                                  span: Span,
                                  mitem: @MetaItem,
                                  in_items: ~[@item]) -> ~[@item] {
@@ -51,7 +51,7 @@ pub fn expand_deriving_decodable(cx: @ExtCtxt,
     trait_def.expand(mitem, in_items)
 }
 
-fn decodable_substructure(cx: @ExtCtxt, span: Span,
+fn decodable_substructure(cx: &ExtCtxt, span: Span,
                           substr: &Substructure) -> @Expr {
     let decoder = substr.nonself_args[0];
     let recurse = ~[cx.ident_of("extra"),
@@ -132,7 +132,7 @@ fn decodable_substructure(cx: @ExtCtxt, span: Span,
 /// Create a decoder for a single enum variant/struct:
 /// - `outer_pat_ident` is the name of this enum variant/struct
 /// - `getarg` should retrieve the `uint`-th field with name `@str`.
-fn decode_static_fields(cx: @ExtCtxt,
+fn decode_static_fields(cx: &ExtCtxt,
                         outer_span: Span,
                         outer_pat_ident: Ident,
                         fields: &StaticFields,
index 393d808a0254e1e435eb6b7f5cea44aeb84ead84..ba2df120796c3ad54c99a0eb993c8eace919250e 100644 (file)
@@ -14,7 +14,7 @@
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_default(cx: @ExtCtxt,
+pub fn expand_deriving_default(cx: &ExtCtxt,
                             span: Span,
                             mitem: @MetaItem,
                             in_items: ~[@item])
@@ -41,7 +41,7 @@ pub fn expand_deriving_default(cx: @ExtCtxt,
     trait_def.expand(mitem, in_items)
 }
 
-fn default_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+fn default_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
     let default_ident = ~[
         cx.ident_of("std"),
         cx.ident_of("default"),
index 09210116c37675a023565d9d78b6c811995581ce..a6cba59aea518bb63b91b224ace9e90e60e8f7e2 100644 (file)
@@ -81,7 +81,7 @@ fn decode(d: &D) -> spanned<T> {
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_encodable(cx: @ExtCtxt,
+pub fn expand_deriving_encodable(cx: &ExtCtxt,
                                  span: Span,
                                  mitem: @MetaItem,
                                  in_items: ~[@item]) -> ~[@item] {
@@ -113,7 +113,7 @@ pub fn expand_deriving_encodable(cx: @ExtCtxt,
     trait_def.expand(mitem, in_items)
 }
 
-fn encodable_substructure(cx: @ExtCtxt, span: Span,
+fn encodable_substructure(cx: &ExtCtxt, span: Span,
                           substr: &Substructure) -> @Expr {
     let encoder = substr.nonself_args[0];
     // throw an underscore in front to suppress unused variable warnings
index b3e2503f8c460995d75156a9c29f5729f443ee0a..2eb0fe30b4b0764f237f7a36bd1c67a3d9564715 100644 (file)
@@ -190,7 +190,7 @@ fn eq(&self, other: &int) -> bool {
 
 pub struct TraitDef<'a> {
     /// The extension context
-    cx: @ExtCtxt,
+    cx: &'a ExtCtxt,
     /// The span for the current #[deriving(Foo)] header.
     span: Span,
 
@@ -300,7 +300,7 @@ pub enum SubstructureFields<'a> {
 all the fields of all the structures, see above for details.
 */
 pub type CombineSubstructureFunc<'a> =
-    'a |@ExtCtxt, Span, &Substructure| -> @Expr;
+    'a |&ExtCtxt, Span, &Substructure| -> @Expr;
 
 /**
 Deal with non-matching enum variants, the arguments are a list
@@ -308,7 +308,7 @@ pub enum SubstructureFields<'a> {
 [variant fields]), and a list of the nonself args of the type
 */
 pub type EnumNonMatchFunc<'a> =
-    'a |@ExtCtxt,
+    'a |&ExtCtxt,
            Span,
            &[(uint, P<ast::variant>, ~[(Span, Option<Ident>, @Expr)])],
            &[@Expr]|
@@ -1076,10 +1076,10 @@ fn create_enum_variant_pattern(&self,
 left-to-right (`true`) or right-to-left (`false`).
 */
 pub fn cs_fold(use_foldl: bool,
-               f: |@ExtCtxt, Span, @Expr, @Expr, &[@Expr]| -> @Expr,
+               f: |&ExtCtxt, Span, @Expr, @Expr, &[@Expr]| -> @Expr,
                base: @Expr,
                enum_nonmatch_f: EnumNonMatchFunc,
-               cx: @ExtCtxt,
+               cx: &ExtCtxt,
                trait_span: Span,
                substructure: &Substructure)
                -> @Expr {
@@ -1115,9 +1115,9 @@ pub fn cs_fold(use_foldl: bool,
 ~~~
 */
 #[inline]
-pub fn cs_same_method(f: |@ExtCtxt, Span, ~[@Expr]| -> @Expr,
+pub fn cs_same_method(f: |&ExtCtxt, Span, ~[@Expr]| -> @Expr,
                       enum_nonmatch_f: EnumNonMatchFunc,
-                      cx: @ExtCtxt,
+                      cx: &ExtCtxt,
                       trait_span: Span,
                       substructure: &Substructure)
                       -> @Expr {
@@ -1149,10 +1149,10 @@ pub fn cs_same_method(f: |@ExtCtxt, Span, ~[@Expr]| -> @Expr,
 */
 #[inline]
 pub fn cs_same_method_fold(use_foldl: bool,
-                           f: |@ExtCtxt, Span, @Expr, @Expr| -> @Expr,
+                           f: |&ExtCtxt, Span, @Expr, @Expr| -> @Expr,
                            base: @Expr,
                            enum_nonmatch_f: EnumNonMatchFunc,
-                           cx: @ExtCtxt,
+                           cx: &ExtCtxt,
                            trait_span: Span,
                            substructure: &Substructure)
                            -> @Expr {
@@ -1179,7 +1179,7 @@ pub fn cs_same_method_fold(use_foldl: bool,
 #[inline]
 pub fn cs_binop(binop: ast::BinOp, base: @Expr,
                 enum_nonmatch_f: EnumNonMatchFunc,
-                cx: @ExtCtxt, trait_span: Span,
+                cx: &ExtCtxt, trait_span: Span,
                 substructure: &Substructure) -> @Expr {
     cs_same_method_fold(
         true, // foldl is good enough
@@ -1197,7 +1197,7 @@ pub fn cs_binop(binop: ast::BinOp, base: @Expr,
 /// cs_binop with binop == or
 #[inline]
 pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc,
-             cx: @ExtCtxt, span: Span,
+             cx: &ExtCtxt, span: Span,
              substructure: &Substructure) -> @Expr {
     cs_binop(ast::BiOr, cx.expr_bool(span, false),
              enum_nonmatch_f,
@@ -1207,7 +1207,7 @@ pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc,
 /// cs_binop with binop == and
 #[inline]
 pub fn cs_and(enum_nonmatch_f: EnumNonMatchFunc,
-              cx: @ExtCtxt, span: Span,
+              cx: &ExtCtxt, span: Span,
               substructure: &Substructure) -> @Expr {
     cs_binop(ast::BiAnd, cx.expr_bool(span, true),
              enum_nonmatch_f,
index 837b8bd59ec9aa09c69e3088a7b9158dab4415a0..8b2ad95e45c5b3f11504c8df890e441be31f5f23 100644 (file)
@@ -15,7 +15,7 @@
 use ext::deriving::generic::*;
 
 
-pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
+pub fn expand_deriving_iter_bytes(cx: &ExtCtxt,
                                   span: Span,
                                   mitem: @MetaItem,
                                   in_items: ~[@item]) -> ~[@item] {
@@ -45,7 +45,7 @@ pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
     trait_def.expand(mitem, in_items)
 }
 
-fn iter_bytes_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+fn iter_bytes_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
     let (lsb0, f)= match substr.nonself_args {
         [l, f] => (l, f),
         _ => cx.span_bug(span, "Incorrect number of arguments in `deriving(IterBytes)`")
index d38f9b4d1b79e1dd05dfe7fa279b9335053628f2..1e8b79c8f350b117560648005a84bb2d5f3947f0 100644 (file)
 
 pub mod generic;
 
-pub type ExpandDerivingStructDefFn<'a> = 'a |@ExtCtxt,
+pub type ExpandDerivingStructDefFn<'a> = 'a |&ExtCtxt,
                                                    Span,
                                                    x: &struct_def,
                                                    Ident,
                                                    y: &Generics|
                                                    -> @item;
-pub type ExpandDerivingEnumDefFn<'a> = 'a |@ExtCtxt,
+pub type ExpandDerivingEnumDefFn<'a> = 'a |&ExtCtxt,
                                                  Span,
                                                  x: &enum_def,
                                                  Ident,
                                                  y: &Generics|
                                                  -> @item;
 
-pub fn expand_meta_deriving(cx: @ExtCtxt,
+pub fn expand_meta_deriving(cx: &ExtCtxt,
                             _span: Span,
                             mitem: @MetaItem,
                             in_items: ~[@item])
index 73ea627ff5457009c927699c77ff86c34b634553..ba2d85f357a7d6627300d94fcb07b5ca1924a648 100644 (file)
@@ -15,7 +15,7 @@
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_from_primitive(cx: @ExtCtxt,
+pub fn expand_deriving_from_primitive(cx: &ExtCtxt,
                                       span: Span,
                                       mitem: @MetaItem,
                                       in_items: ~[@item]) -> ~[@item] {
@@ -64,7 +64,7 @@ pub fn expand_deriving_from_primitive(cx: @ExtCtxt,
     trait_def.expand(mitem, in_items)
 }
 
-fn cs_from(name: &str, cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+fn cs_from(name: &str, cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
     let n = match substr.nonself_args {
         [n] => n,
         _ => cx.span_bug(span, "Incorrect number of arguments in `deriving(FromPrimitive)`")
index 91ed60324cf1a6f5ca2647fa133f9480a33e1260..1491797c8083f438251087b529b0767813f88bb7 100644 (file)
@@ -16,7 +16,7 @@
 use ext::deriving::generic::*;
 use opt_vec;
 
-pub fn expand_deriving_rand(cx: @ExtCtxt,
+pub fn expand_deriving_rand(cx: &ExtCtxt,
                             span: Span,
                             mitem: @MetaItem,
                             in_items: ~[@item])
@@ -50,7 +50,7 @@ pub fn expand_deriving_rand(cx: @ExtCtxt,
     trait_def.expand(mitem, in_items)
 }
 
-fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+fn rand_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
     let rng = match substr.nonself_args {
         [rng] => ~[ rng ],
         _ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`")
@@ -130,7 +130,7 @@ fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
         _ => cx.bug("Non-static method in `deriving(Rand)`")
     };
 
-    fn rand_thing(cx: @ExtCtxt,
+    fn rand_thing(cx: &ExtCtxt,
                   span: Span,
                   ctor_ident: Ident,
                   summary: &StaticFields,
index fd8c21f4f98677d65c0cd9ff4ca77632752205d0..25700f93a33cd5d8cbe6acf5020028fd69837f7a 100644 (file)
@@ -15,7 +15,7 @@
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_to_str(cx: @ExtCtxt,
+pub fn expand_deriving_to_str(cx: &ExtCtxt,
                               span: Span,
                               mitem: @MetaItem,
                               in_items: ~[@item])
@@ -47,7 +47,7 @@ pub fn expand_deriving_to_str(cx: @ExtCtxt,
 // doesn't invoke the to_str() method on each field. Hence we mirror
 // the logic of the repr_to_str() method, but with tweaks to call to_str()
 // on sub-fields.
-fn to_str_substructure(cx: @ExtCtxt, span: Span,
+fn to_str_substructure(cx: &ExtCtxt, span: Span,
                        substr: &Substructure) -> @Expr {
     let to_str = cx.ident_of("to_str");
 
index e606cebc415c46193db4d992b10c5e7cbc84fae3..10e07520a84903757319589331a26d7948dcb961 100644 (file)
@@ -58,7 +58,7 @@ pub fn new_<'r>(path: ~[&'r str],
     }
 
     pub fn to_ty(&self,
-                 cx: @ExtCtxt,
+                 cx: &ExtCtxt,
                  span: Span,
                  self_ty: Ident,
                  self_generics: &Generics)
@@ -66,7 +66,7 @@ pub fn to_ty(&self,
         cx.ty_path(self.to_path(cx, span, self_ty, self_generics), None)
     }
     pub fn to_path(&self,
-                   cx: @ExtCtxt,
+                   cx: &ExtCtxt,
                    span: Span,
                    self_ty: Ident,
                    self_generics: &Generics)
@@ -110,14 +110,14 @@ pub fn nil_ty() -> Ty<'static> {
     Tuple(~[])
 }
 
-fn mk_lifetime(cx: @ExtCtxt, span: Span, lt: &Option<&str>) -> Option<ast::Lifetime> {
+fn mk_lifetime(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> Option<ast::Lifetime> {
     match *lt {
         Some(ref s) => Some(cx.lifetime(span, cx.ident_of(*s))),
         None => None
     }
 }
 
-fn mk_lifetimes(cx: @ExtCtxt, span: Span, lt: &Option<&str>) -> OptVec<ast::Lifetime> {
+fn mk_lifetimes(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> OptVec<ast::Lifetime> {
     match *lt {
         Some(ref s) => opt_vec::with(cx.lifetime(span, cx.ident_of(*s))),
         None => opt_vec::Empty
@@ -126,7 +126,7 @@ fn mk_lifetimes(cx: @ExtCtxt, span: Span, lt: &Option<&str>) -> OptVec<ast::Life
 
 impl<'a> Ty<'a> {
     pub fn to_ty(&self,
-                 cx: @ExtCtxt,
+                 cx: &ExtCtxt,
                  span: Span,
                  self_ty: Ident,
                  self_generics: &Generics)
@@ -164,7 +164,7 @@ pub fn to_ty(&self,
     }
 
     pub fn to_path(&self,
-                   cx: @ExtCtxt,
+                   cx: &ExtCtxt,
                    span: Span,
                    self_ty: Ident,
                    self_generics: &Generics)
@@ -189,7 +189,7 @@ pub fn to_path(&self,
 }
 
 
-fn mk_ty_param(cx: @ExtCtxt, span: Span, name: &str, bounds: &[Path],
+fn mk_ty_param(cx: &ExtCtxt, span: Span, name: &str, bounds: &[Path],
                self_ident: Ident, self_generics: &Generics) -> ast::TyParam {
     let bounds = opt_vec::from(
         bounds.map(|b| {
@@ -219,7 +219,7 @@ pub fn empty() -> LifetimeBounds<'static> {
         }
     }
     pub fn to_generics(&self,
-                       cx: @ExtCtxt,
+                       cx: &ExtCtxt,
                        span: Span,
                        self_ty: Ident,
                        self_generics: &Generics)
@@ -239,7 +239,7 @@ pub fn to_generics(&self,
 }
 
 
-pub fn get_explicit_self(cx: @ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
+pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
     -> (@Expr, ast::explicit_self) {
     let self_path = cx.expr_self(span);
     match *self_ptr {
index 67f14a8d4864570a9afc6ab5d4ec65a061ea23c6..c406dbf0d0117886a48e785b8b88844c7238ab31 100644 (file)
@@ -14,7 +14,7 @@
 use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
-pub fn expand_deriving_zero(cx: @ExtCtxt,
+pub fn expand_deriving_zero(cx: &ExtCtxt,
                             span: Span,
                             mitem: @MetaItem,
                             in_items: ~[@item])
@@ -57,7 +57,7 @@ pub fn expand_deriving_zero(cx: @ExtCtxt,
     trait_def.expand(mitem, in_items)
 }
 
-fn zero_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
+fn zero_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
     let zero_ident = ~[
         cx.ident_of("std"),
         cx.ident_of("num"),
index 15630e37eadd514ca4e23697d164156172950a6d..b5f5f8c41d023e8feb4fc4ba7bd85db8b94f219c 100644 (file)
@@ -22,7 +22,7 @@
 
 use std::os;
 
-pub fn expand_option_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_option_env(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     let var = get_single_str_from_tts(cx, sp, tts, "option_env!");
 
@@ -33,7 +33,7 @@ pub fn expand_option_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
     MRExpr(e)
 }
 
-pub fn expand_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_env(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     let exprs = get_exprs_from_tts(cx, sp, tts);
 
index 2c2669e914cca9cce3d4cc2d3e578389e5092961..9f9c245fe481d882a479f9744bef090732877664 100644 (file)
@@ -32,7 +32,7 @@
 use std::vec;
 
 pub fn expand_expr(extsbox: @mut SyntaxEnv,
-                   cx: @ExtCtxt,
+                   cx: &ExtCtxt,
                    e: @ast::Expr,
                    fld: &MacroExpander)
                    -> @ast::Expr {
@@ -214,7 +214,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
 // NB: there is some redundancy between this and expand_item, below, and
 // they might benefit from some amount of semantic and language-UI merger.
 pub fn expand_mod_items(extsbox: @mut SyntaxEnv,
-                        cx: @ExtCtxt,
+                        cx: &ExtCtxt,
                         module_: &ast::_mod,
                         fld: &MacroExpander)
                         -> ast::_mod {
@@ -271,7 +271,7 @@ macro_rules! with_exts_frame (
 
 // When we enter a module, record it, for the sake of `module!`
 pub fn expand_item(extsbox: @mut SyntaxEnv,
-                   cx: @ExtCtxt,
+                   cx: &ExtCtxt,
                    it: @ast::item,
                    fld: &MacroExpander)
                    -> SmallVector<@ast::item> {
@@ -298,7 +298,7 @@ pub fn contains_macro_escape(attrs: &[ast::Attribute]) -> bool {
 // Support for item-position macro invocations, exactly the same
 // logic as for expression-position macro invocations.
 pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
-                       cx: @ExtCtxt,
+                       cx: &ExtCtxt,
                        it: @ast::item,
                        fld: &MacroExpander)
                        -> SmallVector<@ast::item> {
@@ -407,7 +407,7 @@ fn insert_macro(exts: SyntaxEnv, name: ast::Name, transformer: @Transformer) {
 
 // expand a stmt
 pub fn expand_stmt(extsbox: @mut SyntaxEnv,
-                   cx: @ExtCtxt,
+                   cx: &ExtCtxt,
                    s: &Stmt,
                    fld: &MacroExpander)
                    -> SmallVector<@Stmt> {
@@ -625,7 +625,7 @@ pub fn new_name_finder(idents: ~[ast::Ident]) -> NewNameFinderContext {
 
 // expand a block. pushes a new exts_frame, then calls expand_block_elts
 pub fn expand_block(extsbox: @mut SyntaxEnv,
-                    _: @ExtCtxt,
+                    _: &ExtCtxt,
                     blk: &Block,
                     fld: &MacroExpander)
                     -> P<Block> {
@@ -690,7 +690,7 @@ pub fn renames_to_fold(renames: @mut ~[(ast::Ident,ast::Name)]) -> @ast_fold {
     } as @ast_fold
 }
 
-pub fn new_span(cx: @ExtCtxt, sp: Span) -> Span {
+pub fn new_span(cx: &ExtCtxt, sp: Span) -> Span {
     /* this discards information in the case of macro-defining macros */
     Span {
         lo: sp.lo,
@@ -949,12 +949,12 @@ pub fn inject_std_macros(parse_sess: @mut parse::ParseSess,
     injector.fold_crate(c)
 }
 
-pub struct MacroExpander {
+pub struct MacroExpander<'a> {
     extsbox: @mut SyntaxEnv,
-    cx: @ExtCtxt,
+    cx: &'a ExtCtxt,
 }
 
-impl ast_fold for MacroExpander {
+impl<'a> ast_fold for MacroExpander<'a> {
     fn fold_expr(&self, expr: @ast::Expr) -> @ast::Expr {
         expand_expr(self.extsbox,
                     self.cx,
@@ -1005,10 +1005,10 @@ pub fn expand_crate(parse_sess: @mut parse::ParseSess,
     // every method/element of AstFoldFns in fold.rs.
     let extsbox = syntax_expander_table();
     let cx = ExtCtxt::new(parse_sess, cfg.clone());
-    let expander = @MacroExpander {
+    let expander = MacroExpander {
         extsbox: @mut extsbox,
-        cx: cx,
-    } as @ast_fold;
+        cx: &cx,
+    };
 
     let ret = expander.fold_crate(c);
     parse_sess.span_diagnostic.handler().abort_if_errors();
@@ -1159,7 +1159,7 @@ pub fn mtwt_cancel_outer_mark(tts: &[ast::token_tree], ctxt: ast::SyntaxContext)
     mark_tts(tts,outer_mark)
 }
 
-fn original_span(cx: @ExtCtxt) -> @codemap::ExpnInfo {
+fn original_span(cx: &ExtCtxt) -> @codemap::ExpnInfo {
     let mut relevant_info = cx.backtrace();
     let mut einfo = relevant_info.unwrap();
     loop {
index 5e3e4e15d8e74db55aa5b5ce553e88328de60ba1..f2eab3f1cbc4c43553560e0bdcede0f6a9478d8f 100644 (file)
@@ -15,7 +15,7 @@
 use ext::base;
 use ext::build::AstBuilder;
 
-pub fn expand_syntax_ext(ecx: @base::ExtCtxt, sp: Span,
+pub fn expand_syntax_ext(ecx: &base::ExtCtxt, sp: Span,
                          _tts: &[ast::token_tree]) -> base::MacResult {
     ecx.span_err(sp, "`fmt!` is deprecated, use `format!` instead");
     ecx.parse_sess.span_diagnostic.span_note(sp,
index 98ebc24427d9a5aaa4487e6b275c90a34e2c28b8..2b51203eca5bba049e985b10bba8ff07c4c001af 100644 (file)
@@ -28,8 +28,8 @@ enum ArgumentType {
     String,
 }
 
-struct Context {
-    ecx: @ExtCtxt,
+struct Context<'a> {
+    ecx: &'a ExtCtxt,
     fmtsp: Span,
 
     // Parsed argument expressions and the types that we've found so far for
@@ -50,7 +50,7 @@ struct Context {
     next_arg: uint,
 }
 
-impl Context {
+impl<'a> Context<'a> {
     /// Parses the arguments from the given list of tokens, returning None if
     /// there's a parse error so we can continue parsing other format! expressions.
     fn parse_args(&mut self, sp: Span,
@@ -722,7 +722,7 @@ fn format_arg(&self, sp: Span, argno: Either<uint, @str>,
     }
 }
 
-pub fn expand_args(ecx: @ExtCtxt, sp: Span,
+pub fn expand_args(ecx: &ExtCtxt, sp: Span,
                    tts: &[ast::token_tree]) -> base::MacResult {
     let mut cx = Context {
         ecx: ecx,
index 2007abcc81cf7a64873d763b8cf5f47d897b9871..7dfd487b379fcfad27329283bf7dff73ffbebd6f 100644 (file)
@@ -15,7 +15,7 @@
 use print;
 use parse::token::{get_ident_interner};
 
-pub fn expand_syntax_ext(cx: @ExtCtxt,
+pub fn expand_syntax_ext(cx: &ExtCtxt,
                          sp: codemap::Span,
                          tt: &[ast::token_tree])
                       -> base::MacResult {
index 77cb02522a7e015ccf8b6663f3a75dc82ded49ab..f6086734003e86bcd4d5fcc1e8f44e149c03f107 100644 (file)
@@ -40,11 +40,11 @@ pub mod rt {
     pub use codemap::{BytePos, Span, dummy_spanned};
 
     pub trait ToTokens {
-        fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree];
+        fn to_tokens(&self, _cx: &ExtCtxt) -> ~[token_tree];
     }
 
     impl ToTokens for ~[token_tree] {
-        fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree] {
+        fn to_tokens(&self, _cx: &ExtCtxt) -> ~[token_tree] {
             (*self).clone()
         }
     }
@@ -56,7 +56,7 @@ trait ToSource : ToTokens {
         pub fn to_source() -> ~str;
 
         // If you can make source, you can definitely make tokens.
-        pub fn to_tokens(cx: @ExtCtxt) -> ~[token_tree] {
+        pub fn to_tokens(cx: &ExtCtxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source())
         }
     }
@@ -199,7 +199,7 @@ fn to_source(&self) -> @str {
     macro_rules! impl_to_tokens(
         ($t:ty) => (
             impl ToTokens for $t {
-                fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] {
+                fn to_tokens(&self, cx: &ExtCtxt) -> ~[token_tree] {
                     cx.parse_tts(self.to_source())
                 }
             }
@@ -209,7 +209,7 @@ fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] {
     macro_rules! impl_to_tokens_self(
         ($t:ty) => (
             impl<'a> ToTokens for $t {
-                fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] {
+                fn to_tokens(&self, cx: &ExtCtxt) -> ~[token_tree] {
                     cx.parse_tts(self.to_source())
                 }
             }
@@ -289,7 +289,7 @@ fn parse_tts(&self, s: @str) -> ~[ast::token_tree] {
 
 }
 
-pub fn expand_quote_tokens(cx: @ExtCtxt,
+pub fn expand_quote_tokens(cx: &ExtCtxt,
                            sp: Span,
                            tts: &[ast::token_tree]) -> base::MacResult {
     let (cx_expr, expr) = expand_tts(cx, sp, tts);
@@ -297,14 +297,14 @@ pub fn expand_quote_tokens(cx: @ExtCtxt,
     base::MRExpr(expanded)
 }
 
-pub fn expand_quote_expr(cx: @ExtCtxt,
+pub fn expand_quote_expr(cx: &ExtCtxt,
                          sp: Span,
                          tts: &[ast::token_tree]) -> base::MacResult {
     let expanded = expand_parse_call(cx, sp, "parse_expr", ~[], tts);
     base::MRExpr(expanded)
 }
 
-pub fn expand_quote_item(cx: @ExtCtxt,
+pub fn expand_quote_item(cx: &ExtCtxt,
                          sp: Span,
                          tts: &[ast::token_tree]) -> base::MacResult {
     let e_attrs = cx.expr_vec_uniq(sp, ~[]);
@@ -313,7 +313,7 @@ pub fn expand_quote_item(cx: @ExtCtxt,
     base::MRExpr(expanded)
 }
 
-pub fn expand_quote_pat(cx: @ExtCtxt,
+pub fn expand_quote_pat(cx: &ExtCtxt,
                         sp: Span,
                         tts: &[ast::token_tree]) -> base::MacResult {
     let e_refutable = cx.expr_lit(sp, ast::lit_bool(true));
@@ -322,7 +322,7 @@ pub fn expand_quote_pat(cx: @ExtCtxt,
     base::MRExpr(expanded)
 }
 
-pub fn expand_quote_ty(cx: @ExtCtxt,
+pub fn expand_quote_ty(cx: &ExtCtxt,
                        sp: Span,
                        tts: &[ast::token_tree]) -> base::MacResult {
     let e_param_colons = cx.expr_lit(sp, ast::lit_bool(false));
@@ -331,7 +331,7 @@ pub fn expand_quote_ty(cx: @ExtCtxt,
     base::MRExpr(expanded)
 }
 
-pub fn expand_quote_stmt(cx: @ExtCtxt,
+pub fn expand_quote_stmt(cx: &ExtCtxt,
                          sp: Span,
                          tts: &[ast::token_tree]) -> base::MacResult {
     let e_attrs = cx.expr_vec_uniq(sp, ~[]);
@@ -349,7 +349,7 @@ fn id_ext(str: &str) -> ast::Ident {
 }
 
 // Lift an ident to the expr that evaluates to that ident.
-fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::Expr {
+fn mk_ident(cx: &ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::Expr {
     let e_str = cx.expr_str(sp, cx.str_of(ident));
     cx.expr_method_call(sp,
                         cx.expr_ident(sp, id_ext("ext_cx")),
@@ -357,7 +357,7 @@ fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::Expr {
                         ~[e_str])
 }
 
-fn mk_binop(cx: @ExtCtxt, sp: Span, bop: token::binop) -> @ast::Expr {
+fn mk_binop(cx: &ExtCtxt, sp: Span, bop: token::binop) -> @ast::Expr {
     let name = match bop {
         PLUS => "PLUS",
         MINUS => "MINUS",
@@ -373,7 +373,7 @@ fn mk_binop(cx: @ExtCtxt, sp: Span, bop: token::binop) -> @ast::Expr {
     cx.expr_ident(sp, id_ext(name))
 }
 
-fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
+fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
 
     match *tok {
         BINOP(binop) => {
@@ -528,7 +528,7 @@ fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
 }
 
 
-fn mk_tt(cx: @ExtCtxt, sp: Span, tt: &ast::token_tree)
+fn mk_tt(cx: &ExtCtxt, sp: Span, tt: &ast::token_tree)
     -> ~[@ast::Stmt] {
 
     match *tt {
@@ -570,7 +570,7 @@ fn mk_tt(cx: @ExtCtxt, sp: Span, tt: &ast::token_tree)
     }
 }
 
-fn mk_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+fn mk_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> ~[@ast::Stmt] {
     let mut ss = ~[];
     for tt in tts.iter() {
@@ -579,7 +579,7 @@ fn mk_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
     ss
 }
 
-fn expand_tts(cx: @ExtCtxt,
+fn expand_tts(cx: &ExtCtxt,
               sp: Span,
               tts: &[ast::token_tree]) -> (@ast::Expr, @ast::Expr) {
 
@@ -652,7 +652,7 @@ fn expand_tts(cx: @ExtCtxt,
     (cx_expr, block)
 }
 
-fn expand_wrapper(cx: @ExtCtxt,
+fn expand_wrapper(cx: &ExtCtxt,
                   sp: Span,
                   cx_expr: @ast::Expr,
                   expr: @ast::Expr) -> @ast::Expr {
@@ -667,7 +667,7 @@ fn expand_wrapper(cx: @ExtCtxt,
     cx.expr_block(cx.block_all(sp, uses, ~[stmt_let_ext_cx], Some(expr)))
 }
 
-fn expand_parse_call(cx: @ExtCtxt,
+fn expand_parse_call(cx: &ExtCtxt,
                      sp: Span,
                      parse_method: &str,
                      arg_exprs: ~[@ast::Expr],
index 2fcf6f1cad02501c281a66c43809fc52fa201d0d..cf11bdcce64fadbf32044412053f21cdc40b6fed 100644 (file)
@@ -28,7 +28,7 @@
 // a given file into the current one.
 
 /* line!(): expands to the current line number */
-pub fn expand_line(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_line(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "line!");
 
@@ -39,7 +39,7 @@ pub fn expand_line(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
 }
 
 /* col!(): expands to the current column number */
-pub fn expand_col(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_col(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "col!");
 
@@ -51,7 +51,7 @@ pub fn expand_col(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
 /* file!(): expands to the current filename */
 /* The filemap (`loc.file`) contains a bunch more information we could spit
  * out if we wanted. */
-pub fn expand_file(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_file(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "file!");
 
@@ -61,13 +61,13 @@ pub fn expand_file(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
     base::MRExpr(cx.expr_str(topmost.call_site, filename))
 }
 
-pub fn expand_stringify(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_stringify(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     let s = pprust::tts_to_str(tts, get_ident_interner());
     base::MRExpr(cx.expr_str(sp, s.to_managed()))
 }
 
-pub fn expand_mod(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_mod(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "module_path!");
     base::MRExpr(cx.expr_str(sp,
@@ -77,7 +77,7 @@ pub fn expand_mod(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
 // include! : parse the given file as an expr
 // This is generally a bad idea because it's going to behave
 // unhygienically.
-pub fn expand_include(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_include(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     let file = get_single_str_from_tts(cx, sp, tts, "include!");
     // The file will be added to the code map by the parser
@@ -88,7 +88,7 @@ pub fn expand_include(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
 }
 
 // include_str! : read the given file, insert it as a literal string expr
-pub fn expand_include_str(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_include_str(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
     -> base::MacResult {
     let file = get_single_str_from_tts(cx, sp, tts, "include_str!");
     let file = res_rel_file(cx, sp, &Path::new(file));
@@ -120,7 +120,7 @@ pub fn expand_include_str(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
     }
 }
 
-pub fn expand_include_bin(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
+pub fn expand_include_bin(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
         -> base::MacResult
 {
     use std::at_vec;
@@ -167,7 +167,7 @@ fn topmost_expn_info(expn_info: @codemap::ExpnInfo) -> @codemap::ExpnInfo {
 
 // resolve a file-system path to an absolute file-system path (if it
 // isn't already)
-fn res_rel_file(cx: @ExtCtxt, sp: codemap::Span, arg: &Path) -> Path {
+fn res_rel_file(cx: &ExtCtxt, sp: codemap::Span, arg: &Path) -> Path {
     // NB: relative paths are resolved relative to the compilation unit
     if !arg.is_absolute() {
         let mut cu = Path::new(cx.codemap().span_to_filename(sp));
index 1862d4a88fd4a09e80703274582818d1790fab1c..cd172495d705b07e858b61b3d96f2d76f001eff7 100644 (file)
@@ -16,7 +16,7 @@
 use parse::parser::Parser;
 use parse::token::keywords;
 
-pub fn expand_trace_macros(cx: @ExtCtxt,
+pub fn expand_trace_macros(cx: &ExtCtxt,
                            sp: Span,
                            tt: &[ast::token_tree])
                         -> base::MacResult {
index 8291a76fab65d3107d86d9400b384a374400f2b1..63517ca2269d8aea9dd4c0ac62cdfb91d9435ba1 100644 (file)
@@ -83,7 +83,7 @@ struct MacroRulesSyntaxExpanderTTFun {
 
 impl SyntaxExpanderTTTrait for MacroRulesSyntaxExpanderTTFun {
     fn expand(&self,
-              cx: @ExtCtxt,
+              cx: &ExtCtxt,
               sp: Span,
               arg: &[ast::token_tree],
               _: ast::SyntaxContext)
@@ -93,7 +93,7 @@ fn expand(&self,
 }
 
 // Given `lhses` and `rhses`, this is the new macro we create
-fn generic_extension(cx: @ExtCtxt,
+fn generic_extension(cx: &ExtCtxt,
                      sp: Span,
                      name: Ident,
                      arg: &[ast::token_tree],
@@ -168,7 +168,7 @@ fn generic_extension(cx: @ExtCtxt,
 // this procedure performs the expansion of the
 // macro_rules! macro. It parses the RHS and adds
 // an extension to the current context.
-pub fn add_new_extension(cx: @ExtCtxt,
+pub fn add_new_extension(cx: &ExtCtxt,
                          sp: Span,
                          name: Ident,
                          arg: ~[ast::token_tree],
index 2e426c0413e7418d50ee6dc824b24470ee7e05d1..dc95faa19864766dc30bc1dea4d2b92c21fac9b3 100644 (file)
@@ -16,7 +16,7 @@
 
 use syntax::ext::base::ExtCtxt;
 
-fn syntax_extension(cx: @ExtCtxt) {
+fn syntax_extension(cx: &ExtCtxt) {
     let e_toks : ~[syntax::ast::token_tree] = quote_tokens!(cx, 1 + 2);
     let p_toks : ~[syntax::ast::token_tree] = quote_tokens!(cx, (x, 1 .. 4, *));