reset attributed variable state between toplevel queries (#242)
This commit is contained in:
@@ -179,6 +179,7 @@ pub enum SystemClauseType {
|
||||
FetchGlobalVar,
|
||||
FetchGlobalVarWithOffset,
|
||||
GetChar,
|
||||
ResetAttrVarState,
|
||||
TruncateIfNoLiftedHeapGrowthDiff,
|
||||
TruncateIfNoLiftedHeapGrowth,
|
||||
GetAttributedVariableList,
|
||||
@@ -289,6 +290,7 @@ impl SystemClauseType {
|
||||
clause_name!("$fetch_global_var_with_offset")
|
||||
}
|
||||
&SystemClauseType::GetChar => clause_name!("$get_char"),
|
||||
&SystemClauseType::ResetAttrVarState => clause_name!("$reset_attr_var_state"),
|
||||
&SystemClauseType::TruncateIfNoLiftedHeapGrowth => {
|
||||
clause_name!("$truncate_if_no_lh_growth")
|
||||
}
|
||||
@@ -408,6 +410,7 @@ impl SystemClauseType {
|
||||
("$fetch_global_var", 2) => Some(SystemClauseType::FetchGlobalVar),
|
||||
("$fetch_global_var_with_offset", 3) => Some(SystemClauseType::FetchGlobalVarWithOffset),
|
||||
("$get_char", 1) => Some(SystemClauseType::GetChar),
|
||||
("$reset_attr_var_state", 0) => Some(SystemClauseType::ResetAttrVarState),
|
||||
("$truncate_if_no_lh_growth", 1) => {
|
||||
Some(SystemClauseType::TruncateIfNoLiftedHeapGrowth)
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ impl AttrVarInitializer {
|
||||
|
||||
#[inline]
|
||||
pub(super) fn reset(&mut self) {
|
||||
self.attribute_goals.clear();
|
||||
self.attr_var_queue.clear();
|
||||
self.bindings.clear();
|
||||
self.attribute_goals.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1680,6 +1680,9 @@ impl MachineState {
|
||||
}
|
||||
};
|
||||
},
|
||||
&SystemClauseType::ResetAttrVarState => {
|
||||
self.attr_var_init.reset();
|
||||
}
|
||||
&SystemClauseType::RemoveCallPolicyCheck => {
|
||||
let restore_default = match call_policy.downcast_mut::<CWILCallPolicy>().ok() {
|
||||
Some(call_policy) => {
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
),
|
||||
( '$get_b_value'(B), call(Term), '$write_eqs_and_read_input'(B, VarList), !
|
||||
; write('false.'), nl
|
||||
).
|
||||
),
|
||||
'$reset_attr_var_state'.
|
||||
|
||||
'$needs_bracketing'(Value, Op) :-
|
||||
catch((functor(Value, F, _),
|
||||
|
||||
Reference in New Issue
Block a user