split module source into decl/defin

This commit is contained in:
Aleksey Kladov
2019-01-06 15:58:45 +03:00
parent 9cb02fd931
commit a7f4f7bfcc
6 changed files with 106 additions and 32 deletions

View File

@@ -397,7 +397,7 @@ impl Analysis {
}
/// Returns the root file of the given crate.
pub fn crate_root(&self, crate_id: CrateId) -> Cancelable<FileId> {
Ok(self.db.crate_root(crate_id))
Ok(self.db.crate_graph().crate_root(crate_id))
}
/// Returns the set of possible targets to run for the current file.
pub fn runnables(&self, file_id: FileId) -> Cancelable<Vec<Runnable>> {

View File

@@ -73,11 +73,11 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: ast::Module) -> Opti
let module =
hir::source_binder::module_from_child_node(db, file_id, module.syntax()).ok()??;
let path = module
.path_to_root()
.path_to_root(db)
.ok()?
.into_iter()
.rev()
.into_iter()
.filter_map(|it| it.name().map(Clone::clone))
.filter_map(|it| it.name(db).map(Clone::clone))
.join("::");
Some(Runnable {
range,