mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
internal: Improve rooted upmapping
This commit is contained in:
parent
03d2d9016d
commit
9ba4493918
24 changed files with 231 additions and 153 deletions
|
@ -71,7 +71,7 @@ pub fn visit_file_defs(
|
|||
let mut defs: VecDeque<_> = module.declarations(db).into();
|
||||
while let Some(def) = defs.pop_front() {
|
||||
if let ModuleDef::Module(submodule) = def {
|
||||
if let hir::ModuleSource::Module(_) = submodule.definition_source(db).value {
|
||||
if submodule.is_inline(db) {
|
||||
defs.extend(submodule.declarations(db));
|
||||
submodule.impl_defs(db).into_iter().for_each(|impl_| cb(impl_.into()));
|
||||
}
|
||||
|
|
|
@ -190,22 +190,15 @@ impl SearchScope {
|
|||
let mut entries = IntMap::default();
|
||||
|
||||
let (file_id, range) = {
|
||||
let InFile { file_id, value } = module.definition_source(db);
|
||||
let InFile { file_id, value } = module.definition_source_range(db);
|
||||
if let Some(InRealFile { file_id, value: call_source }) = file_id.original_call_node(db)
|
||||
{
|
||||
(file_id, Some(call_source.text_range()))
|
||||
} else {
|
||||
(
|
||||
file_id.original_file(db),
|
||||
match value {
|
||||
ModuleSource::SourceFile(_) => None,
|
||||
ModuleSource::Module(it) => Some(it.syntax().text_range()),
|
||||
ModuleSource::BlockExpr(it) => Some(it.syntax().text_range()),
|
||||
},
|
||||
)
|
||||
(file_id.original_file(db), Some(value))
|
||||
}
|
||||
};
|
||||
entries.insert(file_id, range);
|
||||
entries.entry(file_id).or_insert(range);
|
||||
|
||||
let mut to_visit: Vec<_> = module.children(db).collect();
|
||||
while let Some(module) = to_visit.pop() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue