Store path in module id.

This commit is contained in:
Stephen Chung
2022-08-25 22:17:01 +08:00
parent 1c335e24dc
commit 5c80157e7a
3 changed files with 9 additions and 2 deletions

View File

@@ -54,8 +54,14 @@ impl StaticModuleResolver {
/// Add a [module][Module] keyed by its path.
#[inline]
pub fn insert(&mut self, path: impl Into<Identifier>, mut module: Module) {
let path = path.into();
if module.id().is_none() {
module.set_id(path.clone());
}
module.build_index();
self.0.insert(path.into(), module.into());
self.0.insert(path, module.into());
}
/// Remove a [module][Module] given its path.
#[inline(always)]