aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_scope.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/item_scope.rs')
-rw-r--r--crates/hir_def/src/item_scope.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_scope.rs b/crates/hir_def/src/item_scope.rs
index 2750e1c91..ee46c3330 100644
--- a/crates/hir_def/src/item_scope.rs
+++ b/crates/hir_def/src/item_scope.rs
@@ -8,6 +8,7 @@ use hir_expand::name::Name;
8use hir_expand::MacroDefKind; 8use hir_expand::MacroDefKind;
9use once_cell::sync::Lazy; 9use once_cell::sync::Lazy;
10use rustc_hash::{FxHashMap, FxHashSet}; 10use rustc_hash::{FxHashMap, FxHashSet};
11use stdx::format_to;
11use test_utils::mark; 12use test_utils::mark;
12 13
13use crate::{ 14use crate::{
@@ -292,6 +293,30 @@ impl ItemScope {
292 *vis = Visibility::Module(this_module); 293 *vis = Visibility::Module(this_module);
293 } 294 }
294 } 295 }
296
297 pub(crate) fn dump(&self, buf: &mut String) {
298 let mut entries: Vec<_> = self.resolutions().collect();
299 entries.sort_by_key(|(name, _)| name.clone());
300
301 for (name, def) in entries {
302 format_to!(buf, "{}:", name.map_or("_".to_string(), |name| name.to_string()));
303
304 if def.types.is_some() {
305 buf.push_str(" t");
306 }
307 if def.values.is_some() {
308 buf.push_str(" v");
309 }
310 if def.macros.is_some() {
311 buf.push_str(" m");
312 }
313 if def.is_none() {
314 buf.push_str(" _");
315 }
316
317 buf.push('\n');
318 }
319 }
295} 320}
296 321
297impl PerNs { 322impl PerNs {