save-analysis: only emit type in the value for variables

This commit is contained in:
Nick Cameron 2016-09-07 08:31:11 -07:00
parent ce413e0da2
commit 493544a1f9
3 changed files with 7 additions and 4 deletions

View File

@ -1427,11 +1427,15 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
for &(id, ref p, immut, ref_kind) in &collector.collected_paths {
match self.tcx.expect_def(id) {
Def::Local(_, id) => {
let value = if immut == ast::Mutability::Immutable {
let mut value = if immut == ast::Mutability::Immutable {
self.span.snippet(p.span).to_string()
} else {
"<mutable>".to_string()
};
let typ = self.tcx.node_types()
.get(&id).map(|t| t.to_string()).unwrap_or(String::new());
value.push_str(": ");
value.push_str(&typ);
assert!(p.segments.len() == 1,
"qualified path for local variable def in arm");
@ -1443,7 +1447,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
name: path_to_string(p),
qualname: format!("{}${}", path_to_string(p), id),
value: value,
type_value: String::new(),
type_value: typ,
scope: 0,
parent: None,
visibility: Visibility::Inherited,

View File

@ -380,7 +380,7 @@ impl From<VariableData> for Def {
span: data.span,
name: data.name,
qualname: data.qualname,
value: data.value,
value: data.type_value,
children: vec![],
decl_id: None,
docs: data.docs,

View File

@ -749,7 +749,6 @@ impl Visitor for PathCollector {
}
}
fn docs_for_attrs(attrs: &[Attribute]) -> String {
let doc = InternedString::new("doc");
let mut result = String::new();