aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/mock.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-19 19:18:41 +0100
committerGitHub <[email protected]>2019-09-19 19:18:41 +0100
commitcd9b222ba0555424d73d549eac43d9aaf1765d7d (patch)
tree88eea12084b65ba7b0f808cc2c626c7b57c7ac53 /crates/ra_hir/src/mock.rs
parent44bab3621d74f1aec922300a3b3f4476907ba2ac (diff)
parent2867c40925e8f7b440ff50a421a2d3726b9ff334 (diff)
Merge #1853
1853: Introduce FromSource trait r=matklad a=viorina The idea is to provide an ability to get HIR from AST in a more general way than it's possible using `source_binder`. It also could help with #1622 fixing. Co-authored-by: Ekaterina Babshukova <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/mock.rs')
-rw-r--r--crates/ra_hir/src/mock.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs
index 8dcea5071..cb405091e 100644
--- a/crates/ra_hir/src/mock.rs
+++ b/crates/ra_hir/src/mock.rs
@@ -93,7 +93,11 @@ impl MockDatabase {
93 let mut files: Vec<FileId> = self.files.values().copied().collect(); 93 let mut files: Vec<FileId> = self.files.values().copied().collect();
94 files.sort(); 94 files.sort();
95 for file in files { 95 for file in files {
96 let module = crate::source_binder::module_from_file_id(self, file).unwrap(); 96 let src = crate::Source {
97 file_id: file.into(),
98 ast: crate::ModuleSource::new(self, Some(file), None),
99 };
100 let module = crate::Module::from_definition(self, src).unwrap();
97 module.diagnostics( 101 module.diagnostics(
98 self, 102 self,
99 &mut DiagnosticSink::new(|d| { 103 &mut DiagnosticSink::new(|d| {