Store path in module id.
This commit is contained in:
parent
1c335e24dc
commit
5c80157e7a
@ -26,6 +26,7 @@ Enhancements
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
* `is_empty` method is added to arrays, BLOB's, object maps, strings and ranges.
|
* `is_empty` method is added to arrays, BLOB's, object maps, strings and ranges.
|
||||||
|
* `StaticModuleResolver` now stores the path in the module's `id` field.
|
||||||
|
|
||||||
|
|
||||||
Version 1.9.0
|
Version 1.9.0
|
||||||
|
@ -113,7 +113,7 @@ impl Engine {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut ast = self.compile_scripts_with_scope(scope, &[script])?;
|
let mut ast = self.compile_with_scope(scope, script)?;
|
||||||
|
|
||||||
let mut resolver = StaticModuleResolver::new();
|
let mut resolver = StaticModuleResolver::new();
|
||||||
let mut imports = BTreeSet::new();
|
let mut imports = BTreeSet::new();
|
||||||
|
@ -54,8 +54,14 @@ impl StaticModuleResolver {
|
|||||||
/// Add a [module][Module] keyed by its path.
|
/// Add a [module][Module] keyed by its path.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn insert(&mut self, path: impl Into<Identifier>, mut module: Module) {
|
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();
|
module.build_index();
|
||||||
self.0.insert(path.into(), module.into());
|
self.0.insert(path, module.into());
|
||||||
}
|
}
|
||||||
/// Remove a [module][Module] given its path.
|
/// Remove a [module][Module] given its path.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
Loading…
Reference in New Issue
Block a user