Fold context into TransItemVisitor.
This commit is contained in:
parent
411dce85ea
commit
2ceebf1070
|
@ -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 {
|
impl Visitor<()> for TransItemVisitor {
|
||||||
fn visit_item(&mut self, i: @ast::item, ccx: @mut CrateContext) {
|
fn visit_item(&mut self, i: @ast::item, _:()) {
|
||||||
trans_item(ccx, i);
|
trans_item(self.ccx, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2235,8 +2237,8 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
|
||||||
} else {
|
} else {
|
||||||
// Be sure to travel more than just one layer deep to catch nested
|
// Be sure to travel more than just one layer deep to catch nested
|
||||||
// items in blocks and such.
|
// items in blocks and such.
|
||||||
let mut v = TransItemVisitor;
|
let mut v = TransItemVisitor{ ccx: ccx };
|
||||||
v.visit_block(body, ccx);
|
v.visit_block(body, ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::item_impl(ref generics, _, _, ref ms) => {
|
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
|
// functions, but the trait still needs to be walked. Otherwise default
|
||||||
// methods with items will not get translated and will cause ICE's when
|
// methods with items will not get translated and will cause ICE's when
|
||||||
// metadata time comes around.
|
// metadata time comes around.
|
||||||
let mut v = TransItemVisitor;
|
let mut v = TransItemVisitor{ ccx: ccx };
|
||||||
visit::walk_item(&mut v, item, ccx);
|
visit::walk_item(&mut v, item, ());
|
||||||
}
|
}
|
||||||
_ => {/* fall through */ }
|
_ => {/* fall through */ }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// Both here and below with generic methods, be sure to recurse and look for
|
||||||
// items that we need to translate.
|
// items that we need to translate.
|
||||||
if !generics.ty_params.is_empty() {
|
if !generics.ty_params.is_empty() {
|
||||||
let mut v = TransItemVisitor;
|
let mut v = TransItemVisitor{ ccx: ccx };
|
||||||
for method in methods.iter() {
|
for method in methods.iter() {
|
||||||
visit::walk_method_helper(&mut v, *method, ccx);
|
visit::walk_method_helper(&mut v, *method, ());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,8 @@ pub fn trans_impl(ccx: @mut CrateContext,
|
||||||
None,
|
None,
|
||||||
llfn);
|
llfn);
|
||||||
} else {
|
} else {
|
||||||
let mut v = TransItemVisitor;
|
let mut v = TransItemVisitor{ ccx: ccx };
|
||||||
visit::walk_method_helper(&mut v, *method, ccx);
|
visit::walk_method_helper(&mut v, *method, ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue