Last active
July 6, 2016 10:25
-
-
Save lqd/ace4ab368756e991e68f2f62e3476102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let is_trait_method = substs.self_ty().is_some(); | |
let (nid, substs, sig) = if !is_trait_method { | |
let nid = self.tcx.map.as_local_node_id(fn_did).expect(""); | |
(nid, *substs, sig) | |
} else { | |
let (resolved_def_id, resolved_substs) = traits::resolve_trait_method(self.tcx, fn_did, substs); | |
let nid = self.tcx.map.as_local_node_id(resolved_def_id).expect(""); | |
let ty = self.tcx.lookup_item_type(resolved_def_id).ty; | |
let sig = ty.fn_sig().skip_binder(); | |
fn_did = resolved_def_id; | |
(nid, resolved_substs, sig) | |
}; | |
let mir = &self.mir_map.map[&nid]; | |
fn_sig = monomorphize::apply_param_substs(self.tcx, substs, sig); | |
if !self.fun_names.contains_key(&(fn_did, fn_sig.clone())) { | |
let mut ctxt = BinaryenFnCtxt { | |
tcx: self.tcx, | |
mir_map: self.mir_map, | |
mir: mir, | |
did: fn_did, | |
sig: &fn_sig, | |
module: self.module, | |
fun_types: &mut self.fun_types, | |
fun_names: &mut self.fun_names, | |
c_strings: &mut self.c_strings, | |
}; | |
debug!("translating monomorphized fn {:?}", self.tcx.item_path_str(fn_did)); | |
ctxt.trans(); | |
debug!("done translating monomorphized {:?}, continuing translation of fn {:?}", | |
self.tcx.item_path_str(fn_did), self.tcx.item_path_str(self.did)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment