Sourcify some things

If we want to support macros properly, we need to get rid of those
FileIds everywhere...
This commit is contained in:
Aleksey Kladov 2019-11-15 23:24:56 +03:00
parent 1889b3c7b5
commit 4c90b7e2ec
6 changed files with 22 additions and 21 deletions

View file

@ -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;

View file

@ -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 } })