properly update dynamically updated predicates in module indices

This commit is contained in:
Mark Thom
2019-03-08 23:11:06 -07:00
parent da0e1b9436
commit 92c36aa0d9
2 changed files with 8 additions and 12 deletions

View File

@@ -183,7 +183,7 @@ fn compile_into_module<R: Read>(wam: &mut Machine, module_name: ClauseName, src:
if module.module_decl.exports.contains(&(name.clone(), arity)) {
if let Some(idx) = wam.indices.code_dir.get(&(name.clone(), arity)) {
if module.module_decl.name == idx.0.borrow().1 {
if module.module_decl.name == module_name {
if module_code.len() > 0 {
set_code_index!(idx, IndexPtr::Index(wam.code_repo.code.len()),
module_name.clone());
@@ -423,11 +423,8 @@ impl ListingCompiler {
let idx = code_dir.entry((name.clone(), arity)).or_insert(CodeIndex::default());
set_code_index!(idx, IndexPtr::Index(p), self.get_module_name());
/*
println!("{}/{}:", name.as_str(), arity);
print_code(&decl_code);
*/
self.localize_self_calls(name, arity, &mut decl_code, p);
self.localize_self_calls(name, arity, &mut decl_code, p);
code.extend(decl_code.into_iter());
}