about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2013-09-25 10:58:40 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2013-09-25 10:58:40 +0200
commit2ceebf10707d695497fa9b47b17ebdf7d1cc3c47 (patch)
tree5471a8098382280b1c39639e13784eaf4fe6726d
parent411dce85eadd4ef8abac9b538c8907ca20865bdd (diff)
downloadrust-2ceebf10707d695497fa9b47b17ebdf7d1cc3c47.tar.gz
rust-2ceebf10707d695497fa9b47b17ebdf7d1cc3c47.zip
Fold context into TransItemVisitor.
-rw-r--r--src/librustc/middle/trans/base.rs18
-rw-r--r--src/librustc/middle/trans/meth.rs8
2 files changed, 14 insertions, 12 deletions
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 41126128cdd..3095aa07533 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -2194,11 +2194,13 @@ pub fn trans_enum_def(ccx: @mut CrateContext, enum_definition: &ast::enum_def,
     }
 }
 
-pub struct TransItemVisitor;
+pub struct TransItemVisitor {
+    ccx: @mut CrateContext,
+}
 
-impl Visitor<@mut CrateContext> for TransItemVisitor {
-    fn visit_item(&mut self, i: @ast::item, ccx: @mut CrateContext) {
-        trans_item(ccx, i);
+impl Visitor<()> for TransItemVisitor {
+    fn visit_item(&mut self, i: @ast::item, _:()) {
+        trans_item(self.ccx, i);
     }
 }
 
@@ -2235,8 +2237,8 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
         } else {
             // Be sure to travel more than just one layer deep to catch nested
             // items in blocks and such.
-            let mut v = TransItemVisitor;
-            v.visit_block(body, ccx);
+            let mut v = TransItemVisitor{ ccx: ccx };
+            v.visit_block(body, ());
         }
       }
       ast::item_impl(ref generics, _, _, ref ms) => {
@@ -2288,8 +2290,8 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
         // functions, but the trait still needs to be walked. Otherwise default
         // methods with items will not get translated and will cause ICE's when
         // metadata time comes around.
-        let mut v = TransItemVisitor;
-        visit::walk_item(&mut v, item, ccx);
+        let mut v = TransItemVisitor{ ccx: ccx };
+        visit::walk_item(&mut v, item, ());
       }
       _ => {/* fall through */ }
     }
diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs
index 934dfabbb4d..fd35d05f0fd 100644
--- a/src/librustc/middle/trans/meth.rs
+++ b/src/librustc/middle/trans/meth.rs
@@ -61,9 +61,9 @@ pub fn trans_impl(ccx: @mut CrateContext,
     // Both here and below with generic methods, be sure to recurse and look for
     // items that we need to translate.
     if !generics.ty_params.is_empty() {
-        let mut v = TransItemVisitor;
+        let mut v = TransItemVisitor{ ccx: ccx };
         for method in methods.iter() {
-            visit::walk_method_helper(&mut v, *method, ccx);
+            visit::walk_method_helper(&mut v, *method, ());
         }
         return;
     }
@@ -80,8 +80,8 @@ pub fn trans_impl(ccx: @mut CrateContext,
                          None,
                          llfn);
         } else {
-            let mut v = TransItemVisitor;
-            visit::walk_method_helper(&mut v, *method, ccx);
+            let mut v = TransItemVisitor{ ccx: ccx };
+            visit::walk_method_helper(&mut v, *method, ());
         }
     }
 }