From 4f8f3393bc3dd9a480319a1b9d66c0778ab30b1e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 21 Nov 2019 16:00:57 +0300 Subject: Reduce visibility --- crates/ra_hir_def/src/resolver.rs | 78 +++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs index 1bc9c1760..7b5c3ec06 100644 --- a/crates/ra_hir_def/src/resolver.rs +++ b/crates/ra_hir_def/src/resolver.rs @@ -369,47 +369,6 @@ impl Resolver { } } -impl Resolver { - pub(crate) fn push_scope(mut self, scope: Scope) -> Resolver { - self.scopes.push(scope); - self - } - - pub(crate) fn push_generic_params_scope( - self, - db: &impl DefDatabase2, - def: GenericDefId, - ) -> Resolver { - let params = db.generic_params(def); - if params.params.is_empty() { - self - } else { - self.push_scope(Scope::GenericParams { def, params }) - } - } - - pub(crate) fn push_impl_block_scope(self, impl_block: ImplId) -> Resolver { - self.push_scope(Scope::ImplBlockScope(impl_block)) - } - - pub(crate) fn push_module_scope( - self, - crate_def_map: Arc, - module_id: CrateModuleId, - ) -> Resolver { - self.push_scope(Scope::ModuleScope(ModuleItemMap { crate_def_map, module_id })) - } - - pub(crate) fn push_expr_scope( - self, - owner: DefWithBodyId, - expr_scopes: Arc, - scope_id: ScopeId, - ) -> Resolver { - self.push_scope(Scope::ExprScope(ExprScope { owner, expr_scopes, scope_id })) - } -} - pub enum ScopeDef { PerNs(PerNs), ImplSelfType(ImplId), @@ -489,6 +448,43 @@ pub fn resolver_for_scope( r } +impl Resolver { + fn push_scope(mut self, scope: Scope) -> Resolver { + self.scopes.push(scope); + self + } + + fn push_generic_params_scope(self, db: &impl DefDatabase2, def: GenericDefId) -> Resolver { + let params = db.generic_params(def); + if params.params.is_empty() { + self + } else { + self.push_scope(Scope::GenericParams { def, params }) + } + } + + fn push_impl_block_scope(self, impl_block: ImplId) -> Resolver { + self.push_scope(Scope::ImplBlockScope(impl_block)) + } + + fn push_module_scope( + self, + crate_def_map: Arc, + module_id: CrateModuleId, + ) -> Resolver { + self.push_scope(Scope::ModuleScope(ModuleItemMap { crate_def_map, module_id })) + } + + fn push_expr_scope( + self, + owner: DefWithBodyId, + expr_scopes: Arc, + scope_id: ScopeId, + ) -> Resolver { + self.push_scope(Scope::ExprScope(ExprScope { owner, expr_scopes, scope_id })) + } +} + pub trait HasResolver { /// Builds a resolver for type references inside this def. fn resolver(self, db: &impl DefDatabase2) -> Resolver; -- cgit v1.2.3