make module code entries immutable (re: issue #27)

This commit is contained in:
Mark Thom
2018-04-18 19:24:32 -06:00
parent a4789a73ef
commit 989d44d702
7 changed files with 73 additions and 59 deletions

View File

@@ -642,7 +642,7 @@ pub fn compile_listing(wam: &mut Machine, src_str: &str) -> EvalSession
} else {
return EvalSession::from(EvalError::ModuleNotFound);
}
wam.use_module_in_toplevel(name);
},
TopLevelPacket::Decl(TopLevel::Declaration(Declaration::UseQualifiedModule(name, exports)), _) => {
@@ -689,7 +689,7 @@ pub fn compile_listing(wam: &mut Machine, src_str: &str) -> EvalSession
}
if let Some(mut module) = module {
module.code_dir.extend(code_dir.into_iter());
module.code_dir.extend(as_module_code_dir(code_dir));
module.op_dir.extend(op_dir.into_iter());
wam.add_module(module, code);