mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
classify module from declaration
This commit is contained in:
parent
93c179531b
commit
55e1910d00
4 changed files with 44 additions and 9 deletions
|
@ -31,9 +31,16 @@ pub(crate) fn classify_name(
|
|||
Some(from_struct_field(db, field))
|
||||
},
|
||||
ast::Module(it) => {
|
||||
let ast = hir::ModuleSource::Module(it);
|
||||
let src = hir::Source { file_id, ast };
|
||||
let def = hir::Module::from_definition(db, src)?;
|
||||
let def = {
|
||||
if !it.has_semi() {
|
||||
let ast = hir::ModuleSource::Module(it);
|
||||
let src = hir::Source { file_id, ast };
|
||||
hir::Module::from_definition(db, src)
|
||||
} else {
|
||||
let src = hir::Source { file_id, ast: it };
|
||||
hir::Module::from_declaration(db, src)
|
||||
}
|
||||
}?;
|
||||
Some(from_module_def(db, def.into(), None))
|
||||
},
|
||||
ast::StructDef(it) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue