aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/resolve.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/resolve.rs')
-rw-r--r--crates/ra_hir/src/resolve.rs25
1 files changed, 1 insertions, 24 deletions
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index ed9fa0491..5e04ca9b6 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -19,7 +19,7 @@ use crate::{
19 code_model::Crate, 19 code_model::Crate,
20 db::HirDatabase, 20 db::HirDatabase,
21 expr::{ExprScopes, PatId, ScopeId}, 21 expr::{ExprScopes, PatId, ScopeId},
22 Adt, DefWithBody, GenericDef, ImplBlock, Local, MacroDef, ModuleDef, PerNs, 22 DefWithBody, GenericDef, Local, MacroDef, PerNs, ScopeDef,
23}; 23};
24 24
25#[derive(Debug, Clone, Default)] 25#[derive(Debug, Clone, Default)]
@@ -420,29 +420,6 @@ impl Resolver {
420 } 420 }
421} 421}
422 422
423/// For IDE only
424pub enum ScopeDef {
425 ModuleDef(ModuleDef),
426 MacroDef(MacroDef),
427 GenericParam(u32),
428 ImplSelfType(ImplBlock),
429 AdtSelfType(Adt),
430 Local(Local),
431 Unknown,
432}
433
434impl From<PerNs> for ScopeDef {
435 fn from(def: PerNs) -> Self {
436 def.take_types()
437 .or_else(|| def.take_values())
438 .map(|module_def_id| ScopeDef::ModuleDef(module_def_id.into()))
439 .or_else(|| {
440 def.get_macros().map(|macro_def_id| ScopeDef::MacroDef(macro_def_id.into()))
441 })
442 .unwrap_or(ScopeDef::Unknown)
443 }
444}
445
446impl Scope { 423impl Scope {
447 fn process_names(&self, db: &impl DefDatabase2, f: &mut dyn FnMut(Name, ScopeDef)) { 424 fn process_names(&self, db: &impl DefDatabase2, f: &mut dyn FnMut(Name, ScopeDef)) {
448 match self { 425 match self {