mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Sourcify some things
If we want to support macros properly, we need to get rid of those FileIds everywhere...
This commit is contained in:
parent
1889b3c7b5
commit
4c90b7e2ec
6 changed files with 22 additions and 21 deletions
|
@ -144,8 +144,8 @@ pub(crate) fn classify_name_ref(
|
|||
}
|
||||
}
|
||||
|
||||
let ast = ModuleSource::from_child_node(db, file_id, &parent);
|
||||
let file_id = file_id.into();
|
||||
let ast = ModuleSource::from_child_node(db, Source::new(file_id, &parent));
|
||||
// FIXME: find correct container and visibility for each case
|
||||
let container = Module::from_definition(db, Source { file_id, ast })?;
|
||||
let visibility = None;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
use hir::Source;
|
||||
use itertools::Itertools;
|
||||
use ra_db::SourceDatabase;
|
||||
use ra_syntax::{
|
||||
|
@ -65,9 +66,8 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: ast::Module) -> Opti
|
|||
return None;
|
||||
}
|
||||
let range = module.syntax().text_range();
|
||||
let src = hir::ModuleSource::from_child_node(db, file_id, &module.syntax());
|
||||
let module =
|
||||
hir::Module::from_definition(db, hir::Source { file_id: file_id.into(), ast: src })?;
|
||||
let src = hir::ModuleSource::from_child_node(db, Source::new(file_id.into(), &module.syntax()));
|
||||
let module = hir::Module::from_definition(db, Source::new(file_id.into(), src))?;
|
||||
|
||||
let path = module.path_to_root(db).into_iter().rev().filter_map(|it| it.name(db)).join("::");
|
||||
Some(Runnable { range, kind: RunnableKind::TestMod { path } })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue