correct abolish/1

This commit is contained in:
Mark Thom
2019-03-06 09:54:27 -07:00
parent d49917c88f
commit 07fe30c970
3 changed files with 4 additions and 8 deletions

View File

@@ -566,7 +566,7 @@ abolish(Pred) :-
; Arity < 0 -> throw(domain_error(not_less_than_zero, Arity), abolish/1) ; Arity < 0 -> throw(domain_error(not_less_than_zero, Arity), abolish/1)
; max_arity(N), Arity > N -> throw(representation_error(max_arity), abolish/1) ; max_arity(N), Arity > N -> throw(representation_error(max_arity), abolish/1)
; functor(Head, Name, Arity) -> ; functor(Head, Name, Arity) ->
( '$no_such_predicate'(Head) -> true ( '$no_such_predicate'(Head) -> '$abolish_clause'(Name, Arity)
; '$head_is_dynamic'(Head) -> '$abolish_clause'(Name, Arity) ; '$head_is_dynamic'(Head) -> '$abolish_clause'(Name, Arity)
; throw(error(permission_error(modify, static_procedure, Pred), abolish/1)) ; throw(error(permission_error(modify, static_procedure, Pred), abolish/1))
) )

View File

@@ -69,8 +69,7 @@ impl Machine {
set_code_index!(idx, IndexPtr::Undefined, clause_name!("user")); set_code_index!(idx, IndexPtr::Undefined, clause_name!("user"));
} }
self.indices.code_dir.remove(&(name.clone(), arity)); self.indices.remove_code_index((name, arity));
self.indices.dynamic_code_dir.remove(&(name, arity));
} }
fn handle_eval_result_from_dynamic_compile(&mut self, pred_str: String, name: ClauseName, fn handle_eval_result_from_dynamic_compile(&mut self, pred_str: String, name: ClauseName,

View File

@@ -103,11 +103,8 @@ impl SubModuleUser for IndexStore {
fn remove_code_index(&mut self, key: PredicateKey) fn remove_code_index(&mut self, key: PredicateKey)
{ {
self.code_dir.remove(&key); self.code_dir.remove(&key);
self.dynamic_code_dir.remove(&key);
if self.dynamic_code_dir.contains_key(&key) {
self.dynamic_code_dir.remove(&key);
}
} }
fn insert_dir_entry(&mut self, name: ClauseName, arity: usize, idx: ModuleCodeIndex) fn insert_dir_entry(&mut self, name: ClauseName, arity: usize, idx: ModuleCodeIndex)