fix #255 (I think?)

This commit is contained in:
Mark Thom
2020-02-21 01:02:52 -07:00
parent d48ac09e25
commit be3cdcd71a
5 changed files with 11 additions and 18 deletions

View File

@@ -1,6 +1,5 @@
driver(Vars, Values) :-
iterate(Vars, Values, ListOfListsOfGoalLists),
'$clear_attr_var_bindings',
!,
call_goals(ListOfListsOfGoalLists),
'$return_from_verify_attr'.
@@ -17,13 +16,6 @@ gather_modules([Attr|Attrs], [Module|Modules]) :-
'$module_of'(Module, Attr), % write the owning module of Attr to Module.
gather_modules(Attrs, Modules).
verify_attrs([Module|Modules], Var, Value, [Goals|ListOfGoalLists]) :-
catch(Module:verify_attributes(Var, Value, Goals),
error(evaluation_error((Module:verify_attributes)/3), verify_attributes/3),
Goals = []),
verify_attrs(Modules, Var, Value, ListOfGoalLists).
verify_attrs([], _, _, []).
call_verify_attributes(Attrs, _, _, []) :-
var(Attrs), !.
call_verify_attributes([], _, _, []).
@@ -32,6 +24,13 @@ call_verify_attributes([Attr|Attrs], Var, Value, ListOfGoalLists) :-
sort(Modules0, Modules),
verify_attrs(Modules, Var, Value, ListOfGoalLists).
verify_attrs([Module|Modules], Var, Value, [Goals|ListOfGoalLists]) :-
catch(Module:verify_attributes(Var, Value, Goals),
error(evaluation_error((Module:verify_attributes)/3), verify_attributes/3),
Goals = []),
verify_attrs(Modules, Var, Value, ListOfGoalLists).
verify_attrs([], _, _, []).
call_goals([ListOfGoalLists | ListsCubed]) :-
call_goals_0(ListOfGoalLists),
call_goals(ListsCubed).

View File

@@ -73,11 +73,10 @@ impl MachineState {
let iter = self
.attr_var_init
.bindings
.iter()
.map(|(_, ref addr)| addr.clone());
.drain(0 ..)
.map(|(_, addr)| addr);
let value_list_addr = Addr::HeapCell(self.heap.to_list(iter));
(var_list_addr, value_list_addr)
}

View File

@@ -191,7 +191,8 @@ impl MachineState {
self.trail(TrailRef::from(Ref::PStrTail(h, pstr_len)));
}
pub(super) fn bind(&mut self, r1: Ref, a2: Addr) {
pub(super)
fn bind(&mut self, r1: Ref, a2: Addr) {
let t1 = self.store(r1.as_addr());
let t2 = self.store(a2.clone());

View File

@@ -1973,9 +1973,6 @@ impl MachineState {
}
};
}
&SystemClauseType::ClearAttrVarBindings => {
self.attr_var_init.bindings.clear();
}
&SystemClauseType::RedoAttrVarBinding => {
let var = self.store(self.deref(self[temp_v!(1)].clone()));
let value = self.store(self.deref(self[temp_v!(2)].clone()));