Quantcast
Channel: Recent Gists from luqmana
Viewing all articles
Browse latest Browse all 41

gist:6106904

$
0
0
gistfile1.rs
fn find_fn(ccx: @mut CrateContext, fn_id: ast::node_id) -> Option<codemap::span> {
match ccx.tcx.def_map.find(&fn_id) {
Some(&ast::def_fn(def_id, _)) => {
if ast_util::is_local(def_id) {
match ccx.tcx.items.find(&def_id.node) {
Some(&ast_map::node_item(item, _)) => {
match item.node {
ast::item_fn(*) => Some(item.span),
_ => None
}
}
None => None
}
} else {
let search = csearch::maybe_get_item_ast(
ccx.tcx, def_id,
|a, b, c, d| astencode::decode_inlined_item(a, b, ccx.maps(), c.clone(), d));
match search {
csearch::found(ast::ii_item(item)) => {
match item.node {
ast::item_fn(*) => Some(item.span),
_ => None
}
}
_ => None
}
}
}
_ => None
}
}

Viewing all articles
Browse latest Browse all 41

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>