Encapsulate imported modules into AST.

This commit is contained in:
Stephen Chung
2020-11-09 21:52:23 +08:00
parent 821e64adc4
commit e69444293c
8 changed files with 47 additions and 17 deletions

View File

@@ -1392,7 +1392,7 @@ impl Module {
});
// Modules left in the scope become sub-modules
mods.into_iter().for_each(|(alias, m)| {
mods.iter().for_each(|(alias, m)| {
module.modules.insert(alias.to_string(), m.as_ref().clone());
});
@@ -1407,6 +1407,7 @@ impl Module {
// Encapsulate AST environment
let mut func = func.as_ref().clone();
func.lib = Some(ast_lib.clone());
func.mods = mods.clone();
module.set_script_fn(func.into());
});
}