mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Reduce visibility
This commit is contained in:
parent
36758f2767
commit
4f8f3393bc
1 changed files with 37 additions and 41 deletions
|
@ -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<CrateDefMap>,
|
|
||||||
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<ExprScopes>,
|
|
||||||
scope_id: ScopeId,
|
|
||||||
) -> Resolver {
|
|
||||||
self.push_scope(Scope::ExprScope(ExprScope { owner, expr_scopes, scope_id }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum ScopeDef {
|
pub enum ScopeDef {
|
||||||
PerNs(PerNs),
|
PerNs(PerNs),
|
||||||
ImplSelfType(ImplId),
|
ImplSelfType(ImplId),
|
||||||
|
@ -489,6 +448,43 @@ pub fn resolver_for_scope(
|
||||||
r
|
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<CrateDefMap>,
|
||||||
|
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<ExprScopes>,
|
||||||
|
scope_id: ScopeId,
|
||||||
|
) -> Resolver {
|
||||||
|
self.push_scope(Scope::ExprScope(ExprScope { owner, expr_scopes, scope_id }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait HasResolver {
|
pub trait HasResolver {
|
||||||
/// Builds a resolver for type references inside this def.
|
/// Builds a resolver for type references inside this def.
|
||||||
fn resolver(self, db: &impl DefDatabase2) -> Resolver;
|
fn resolver(self, db: &impl DefDatabase2) -> Resolver;
|
||||||
|
|
Loading…
Reference in a new issue