Re-index imported modules if they are not yet indexed.

This commit is contained in:
Stephen Chung
2020-11-08 14:29:54 +08:00
parent 9a669ffe29
commit 1e07e4356e
6 changed files with 55 additions and 20 deletions

View File

@@ -155,7 +155,7 @@ impl ModuleResolver for FileModuleResolver {
Box::new(EvalAltResult::ErrorInModule(path.to_string(), err, pos))
})?;
m.index_all_sub_modules();
m.build_index();
let m: Shared<Module> = m.into();
module = Some(m.clone());

View File

@@ -50,7 +50,7 @@ impl StaticModuleResolver {
/// Add a module keyed by its path.
#[inline(always)]
pub fn insert(&mut self, path: impl Into<String>, mut module: Module) {
module.index_all_sub_modules();
module.build_index();
self.0.insert(path.into(), module.into());
}
/// Remove a module given its path.