diff options
author | Kirill Bulatov <[email protected]> | 2021-02-28 22:05:22 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2021-03-08 21:59:20 +0000 |
commit | e74c55bb4adcad001b0f7373ebff795fc2aaeb1b (patch) | |
tree | 89bd5dd5a67183d5f94988f35b5c43b70846f293 /crates/hir/src | |
parent | 89d410cef571f5fa7631b17e2fbe52a8f8f03990 (diff) |
Refactor the import location
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 62692c2c1..c4691d34c 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -1115,6 +1115,7 @@ pub enum AssocItem { | |||
1115 | Const(Const), | 1115 | Const(Const), |
1116 | TypeAlias(TypeAlias), | 1116 | TypeAlias(TypeAlias), |
1117 | } | 1117 | } |
1118 | #[derive(Debug)] | ||
1118 | pub enum AssocItemContainer { | 1119 | pub enum AssocItemContainer { |
1119 | Trait(Trait), | 1120 | Trait(Trait), |
1120 | Impl(Impl), | 1121 | Impl(Impl), |
@@ -2148,6 +2149,16 @@ impl ScopeDef { | |||
2148 | } | 2149 | } |
2149 | } | 2150 | } |
2150 | 2151 | ||
2152 | impl From<ItemInNs> for ScopeDef { | ||
2153 | fn from(item: ItemInNs) -> Self { | ||
2154 | match item { | ||
2155 | ItemInNs::Types(id) => ScopeDef::ModuleDef(id.into()), | ||
2156 | ItemInNs::Values(id) => ScopeDef::ModuleDef(id.into()), | ||
2157 | ItemInNs::Macros(id) => ScopeDef::MacroDef(id.into()), | ||
2158 | } | ||
2159 | } | ||
2160 | } | ||
2161 | |||
2151 | pub trait HasVisibility { | 2162 | pub trait HasVisibility { |
2152 | fn visibility(&self, db: &dyn HirDatabase) -> Visibility; | 2163 | fn visibility(&self, db: &dyn HirDatabase) -> Visibility; |
2153 | fn is_visible_from(&self, db: &dyn HirDatabase, module: Module) -> bool { | 2164 | fn is_visible_from(&self, db: &dyn HirDatabase, module: Module) -> bool { |