librustc: De-@mut the CollectFreevarsVisitor

This commit is contained in:
Patrick Walton 2013-12-20 20:24:18 -08:00
parent 2fa456d4f4
commit eb9eade1df

View File

@ -33,8 +33,8 @@ pub struct freevar_entry {
pub type freevar_map = @mut HashMap<ast::NodeId, freevar_info>;
struct CollectFreevarsVisitor {
seen: @mut HashMap<ast::NodeId, ()>,
refs: @mut ~[@freevar_entry],
seen: HashMap<ast::NodeId, ()>,
refs: ~[@freevar_entry],
def_map: resolve::DefMap,
}
@ -90,8 +90,8 @@ fn visit_expr(&mut self, expr:@ast::Expr, depth:int) {
// in order to start the search.
fn collect_freevars(def_map: resolve::DefMap, blk: ast::P<ast::Block>)
-> freevar_info {
let seen = @mut HashMap::new();
let refs = @mut ~[];
let seen = HashMap::new();
let refs = ~[];
let mut v = CollectFreevarsVisitor {
seen: seen,
@ -100,7 +100,11 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::P<ast::Block>)
};
v.visit_block(blk, 1);
return @(*refs).clone();
let CollectFreevarsVisitor {
refs,
..
} = v;
return @refs;
}
struct AnnotateFreevarsVisitor {