diff options
Diffstat (limited to 'src/reports/source_hierarchy.rs')
-rw-r--r-- | src/reports/source_hierarchy.rs | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/reports/source_hierarchy.rs b/src/reports/source_hierarchy.rs index 9478c56..39550ab 100644 --- a/src/reports/source_hierarchy.rs +++ b/src/reports/source_hierarchy.rs @@ -30,29 +30,26 @@ impl<'a> SourceHierarchy<'a> { false => eprint!("├── "), true => eprint!("└── "), } - if let Some(unit) = self.resolver.source_units.get(id) { - let path_str = &unit.source_unit.main.path.as_os_str().to_string_lossy(); - if let Some(name_str) = unit.source_unit.name() { - eprint!("{name_str}{BLUE}"); - if unit.source_unit.head.is_some() { eprint!(" +head") } - if unit.source_unit.tail.is_some() { eprint!(" +tail") } - let mut unresolved = 0; - for symbol in &self.resolver.unresolved { - if symbol.source_id == id { unresolved += 1; } - } - if unresolved > 0 { eprint!("{RED} ({unresolved})"); } - eprintln!("{NORMAL} {DIM}({path_str}){NORMAL}"); - } else { - eprintln!("{path_str}"); - } - levels.push(end); - let len = unit.child_ids.len(); - for (i, id) in unit.child_ids.iter().enumerate() { - let end = i + 1 == len; - self.report_leaf(*id, levels.clone(), end); + let unit = &self.resolver.source_units[id]; + let path_str = &unit.source_unit.main.path.as_os_str().to_string_lossy(); + if let Some(name_str) = unit.source_unit.name() { + eprint!("{name_str}{BLUE}"); + if unit.source_unit.head.is_some() { eprint!(" +head") } + if unit.source_unit.tail.is_some() { eprint!(" +tail") } + let mut unresolved = 0; + for symbol in &self.resolver.unresolved { + if symbol.source_id == id { unresolved += 1; } } + if unresolved > 0 { eprint!("{RED} ({unresolved})"); } + eprintln!("{NORMAL} {DIM}({path_str}){NORMAL}"); } else { - eprintln!("<error loading source unit details>"); + eprintln!("{path_str}"); + } + levels.push(end); + let len = unit.child_ids.len(); + for (i, id) in unit.child_ids.iter().enumerate() { + let end = i + 1 == len; + self.report_leaf(*id, levels.clone(), end); } } } |