mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
New krate() method in Resolver.
Renamed Impl to ImplBlock.
This commit is contained in:
parent
e85ee60c42
commit
8ebb20edce
5 changed files with 49 additions and 59 deletions
|
@ -5,13 +5,15 @@ use rustc_hash::FxHashMap;
|
|||
|
||||
use crate::{
|
||||
ModuleDef,
|
||||
code_model_api::Crate,
|
||||
db::HirDatabase,
|
||||
name::{Name, KnownName},
|
||||
nameres::{PerNs, CrateDefMap, CrateModuleId},
|
||||
generics::GenericParams,
|
||||
expr::{scope::{ExprScopes, ScopeId}, PatId},
|
||||
impl_block::ImplBlock,
|
||||
path::Path, Trait
|
||||
path::Path,
|
||||
Trait
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
|
@ -190,13 +192,17 @@ impl Resolver {
|
|||
.flatten()
|
||||
}
|
||||
|
||||
pub(crate) fn module(&self) -> Option<(&CrateDefMap, CrateModuleId)> {
|
||||
fn module(&self) -> Option<(&CrateDefMap, CrateModuleId)> {
|
||||
self.scopes.iter().rev().find_map(|scope| match scope {
|
||||
Scope::ModuleScope(m) => Some((&*m.crate_def_map, m.module_id)),
|
||||
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn krate(&self) -> Option<Crate> {
|
||||
self.module().map(|t| t.0.krate())
|
||||
}
|
||||
}
|
||||
|
||||
impl Resolver {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue