save-analysis: add references to paths to get_path_data

This commit is contained in:
Nick Cameron 2015-07-25 17:05:34 +12:00
parent 82d40cb2ba
commit 52fd69c933

View file

@ -63,6 +63,8 @@ pub enum Data {
VariableRefData(VariableRefData),
/// Data for a reference to a type or trait.
TypeRefData(TypeRefData),
/// Data for a reference to a module.
ModRefData(ModRefData),
/// Data about a function call.
FunctionCallData(FunctionCallData),
/// Data about a method call.
@ -143,6 +145,14 @@ pub struct TypeRefData {
pub ref_id: DefId,
}
/// Data for a reference to a module.
#[derive(Debug)]
pub struct ModRefData {
pub span: Span,
pub scope: NodeId,
pub ref_id: DefId,
}
/// Data about a function call.
#[derive(Debug)]
pub struct FunctionCallData {
@ -585,6 +595,13 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
scope: self.enclosing_scope(id),
})
}
def::DefMod(def_id) => {
Data::ModRefData(ModRefData {
ref_id: def_id,
span: sub_span.unwrap(),
scope: self.enclosing_scope(id),
})
}
_ => self.tcx.sess.span_bug(path.span,
&format!("Unexpected def kind while looking \
up path in `{}`: `{:?}`",