From bcfb3700ce5249d79368eda974b738617a83f894 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 25 Mar 2020 04:45:42 +0800 Subject: Add ItemScope::visibility_of --- crates/ra_hir/src/code_model.rs | 4 ++++ crates/ra_hir/src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src') 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 { .collect() } + pub fn visibility_of(self, db: &dyn HirDatabase, def: &ModuleDef) -> Option { + db.crate_def_map(self.id.krate)[self.id.local_id].scope.visbility_of(def.clone().into()) + } + pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { let _p = profile("Module::diagnostics"); 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::{ Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Const, Crate, CrateDependency, DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, HasAttrs, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct, - StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, + StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility, }, has_source::HasSource, semantics::{original_range, PathResolution, Semantics, SemanticsScope}, -- cgit v1.2.3