mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-18 09:30:31 +00:00
internal: perpare to remove ModuleData::default
This commit is contained in:
parent
107e07458c
commit
d40cf52e6d
1 changed files with 10 additions and 6 deletions
|
@ -202,12 +202,7 @@ pub struct ModuleData {
|
||||||
|
|
||||||
impl Default for ModuleData {
|
impl Default for ModuleData {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
ModuleData {
|
ModuleData::new(ModuleOrigin::CrateRoot { definition: FileId(!0) })
|
||||||
parent: None,
|
|
||||||
children: FxHashMap::default(),
|
|
||||||
scope: ItemScope::default(),
|
|
||||||
origin: ModuleOrigin::CrateRoot { definition: FileId(!0) },
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,6 +445,15 @@ impl DefMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleData {
|
impl ModuleData {
|
||||||
|
pub(crate) fn new(origin: ModuleOrigin) -> Self {
|
||||||
|
ModuleData {
|
||||||
|
parent: None,
|
||||||
|
children: FxHashMap::default(),
|
||||||
|
scope: ItemScope::default(),
|
||||||
|
origin,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
|
/// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
|
||||||
pub fn definition_source(&self, db: &dyn DefDatabase) -> InFile<ModuleSource> {
|
pub fn definition_source(&self, db: &dyn DefDatabase) -> InFile<ModuleSource> {
|
||||||
self.origin.definition_source(db)
|
self.origin.definition_source(db)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue