mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
New VFS
This commit is contained in:
parent
7aa66371ee
commit
dad1333b48
46 changed files with 1028 additions and 1001 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use either::Either;
|
||||
use hir_def::{
|
||||
nameres::ModuleSource,
|
||||
nameres::{ModuleOrigin, ModuleSource},
|
||||
src::{HasChildSource, HasSource as _},
|
||||
Lookup, VariantId,
|
||||
};
|
||||
|
@ -29,6 +29,14 @@ impl Module {
|
|||
def_map[self.id.local_id].definition_source(db.upcast())
|
||||
}
|
||||
|
||||
pub fn is_mod_rs(self, db: &dyn HirDatabase) -> bool {
|
||||
let def_map = db.crate_def_map(self.id.krate);
|
||||
match def_map[self.id.local_id].origin {
|
||||
ModuleOrigin::File { is_mod_rs, .. } => is_mod_rs,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
|
||||
/// `None` for the crate root.
|
||||
pub fn declaration_source(self, db: &dyn HirDatabase) -> Option<InFile<ast::Module>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue