mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 23:25:03 +00:00
Create modules via SourceBinder
This commit is contained in:
parent
9a6c26e348
commit
595b06a1b8
10 changed files with 65 additions and 112 deletions
|
@ -23,6 +23,7 @@ pub enum Severity {
|
|||
|
||||
pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> {
|
||||
let _p = profile("diagnostics");
|
||||
let mut sb = hir::SourceBinder::new(db);
|
||||
let parse = db.parse(file_id);
|
||||
let mut res = Vec::new();
|
||||
|
||||
|
@ -108,10 +109,7 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
|
|||
fix: Some(fix),
|
||||
})
|
||||
});
|
||||
let source_file = db.parse(file_id).tree();
|
||||
let src =
|
||||
hir::InFile { file_id: file_id.into(), value: hir::ModuleSource::SourceFile(source_file) };
|
||||
if let Some(m) = hir::Module::from_definition(db, src) {
|
||||
if let Some(m) = sb.to_module_def(file_id) {
|
||||
m.diagnostics(db, &mut sink);
|
||||
};
|
||||
drop(sink);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue