diff options
author | Edwin Cheng <[email protected]> | 2020-03-24 20:45:42 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-03-24 20:45:42 +0000 |
commit | bcfb3700ce5249d79368eda974b738617a83f894 (patch) | |
tree | 8b9406d7e7874aebc1ffa735015920c57fb826f8 /crates/ra_hir | |
parent | 7c2cc85806b6b9104e9d614aa71f841fd3627596 (diff) |
Add ItemScope::visibility_of
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/lib.rs | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index c5cfd875f..3f0ebca0d 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -234,6 +234,10 @@ impl Module { | |||
234 | .collect() | 234 | .collect() |
235 | } | 235 | } |
236 | 236 | ||
237 | pub fn visibility_of(self, db: &dyn HirDatabase, def: &ModuleDef) -> Option<Visibility> { | ||
238 | db.crate_def_map(self.id.krate)[self.id.local_id].scope.visbility_of(def.clone().into()) | ||
239 | } | ||
240 | |||
237 | pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { | 241 | pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { |
238 | let _p = profile("Module::diagnostics"); | 242 | let _p = profile("Module::diagnostics"); |
239 | let crate_def_map = db.crate_def_map(self.id.krate); | 243 | let crate_def_map = db.crate_def_map(self.id.krate); |
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 713d45f48..5af7e5d6d 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -54,7 +54,7 @@ pub use crate::{ | |||
54 | Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Const, Crate, CrateDependency, | 54 | Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Const, Crate, CrateDependency, |
55 | DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, HasAttrs, | 55 | DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, HasAttrs, |
56 | HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct, | 56 | HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct, |
57 | StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, | 57 | StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility, |
58 | }, | 58 | }, |
59 | has_source::HasSource, | 59 | has_source::HasSource, |
60 | semantics::{original_range, PathResolution, Semantics, SemanticsScope}, | 60 | semantics::{original_range, PathResolution, Semantics, SemanticsScope}, |