Skip to content

Commit

Permalink
save-analysis: add references to paths to get_path_data
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Jul 25, 2015
1 parent 82d40cb commit 52fd69c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/librustc_trans/save/mod.rs
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 `{}`: `{:?}`",
Expand Down

0 comments on commit 52fd69c

Please sign in to comment.