use util::common::time;
use util::ppaux::Repr;
use util::ppaux;
-use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
+use util::nodemap::{DefIdMap, FnvHashMap};
use std::cell::RefCell;
use std::rc::Rc;
substs: ty::substs
}
-#[deriving(Clone, Eq, Hash)]
+#[deriving(Clone, Eq, TotalEq, Hash, Show)]
pub struct MethodCall {
expr_id: ast::NodeId,
autoderef: u32
}
}
-pub type vtable_map = @RefCell<NodeMap<vtable_res>>;
+pub type vtable_map = @RefCell<FnvHashMap<MethodCall, vtable_res>>;
// Information about the vtable resolutions for a trait impl.
pub fn write_ty_to_tcx(tcx: &ty::ctxt, node_id: ast::NodeId, ty: ty::t) {
debug!("write_ty_to_tcx({}, {})", node_id, ppaux::ty_to_str(tcx, ty));
assert!(!ty::type_needs_infer(ty));
- let mut node_types = tcx.node_types.borrow_mut();
- node_types.get().insert(node_id as uint, ty);
+ tcx.node_types.borrow_mut().insert(node_id as uint, ty);
}
pub fn write_substs_to_tcx(tcx: &ty::ctxt,
node_id: ast::NodeId,
substs.map(|t| ppaux::ty_to_str(tcx, *t)));
assert!(substs.iter().all(|t| !ty::type_needs_infer(*t)));
- let mut node_type_substs = tcx.node_type_substs.borrow_mut();
- node_type_substs.get().insert(node_id, substs);
+ tcx.node_type_substs.borrow_mut().insert(node_id, substs);
}
}
pub fn write_tpt_to_tcx(tcx: &ty::ctxt,
}
pub fn lookup_def_tcx(tcx:&ty::ctxt, sp: Span, id: ast::NodeId) -> ast::Def {
- let def_map = tcx.def_map.borrow();
- match def_map.get().find(&id) {
+ match tcx.def_map.borrow().find(&id) {
Some(&x) => x,
_ => {
tcx.sess.span_fatal(sp, "internal error looking up a definition")
let ccx = CrateCtxt {
trait_map: trait_map,
method_map: @RefCell::new(FnvHashMap::new()),
- vtable_map: @RefCell::new(NodeMap::new()),
+ vtable_map: @RefCell::new(FnvHashMap::new()),
tcx: tcx
};