fix HeapPStrIter bug not recognizing nil focus if PStrLoc points to PStrOffset to CStr
This commit is contained in:
@@ -691,14 +691,10 @@ expand_goal_cases((\+ Goals0), Module, ExpandedGoals, HeadVars) :-
|
||||
expand_goal_cases((Module:Goals0), _, ExpandedGoals, HeadVars) :-
|
||||
expand_goal(Goals0, Module, Goals1, HeadVars),
|
||||
ExpandedGoals = (Module:Goals1).
|
||||
expand_goal_cases(call(Goals0), _, ExpandedGoals, HeadVars) :-
|
||||
expand_goal(Goals0, Module, Goals1, HeadVars),
|
||||
ExpandedGoals = call(Goals1).
|
||||
|
||||
expand_goal(UnexpandedGoals, Module, ExpandedGoals, HeadVars) :-
|
||||
( var(UnexpandedGoals) ->
|
||||
UnexpandedGoals = ExpandedGoals
|
||||
% expand_module_names(call(UnexpandedGoals), [0], Module, ExpandedGoals, HeadVars)
|
||||
expand_module_names(call(UnexpandedGoals), [0], Module, ExpandedGoals, HeadVars)
|
||||
; goal_expansion(UnexpandedGoals, Module, UnexpandedGoals1),
|
||||
( Module \== user ->
|
||||
goal_expansion(UnexpandedGoals1, user, Goals)
|
||||
|
||||
@@ -45,25 +45,6 @@ pub enum TermOrderCategory {
|
||||
Compound,
|
||||
}
|
||||
|
||||
// the position-dependent heap template:
|
||||
|
||||
/*
|
||||
read_heap_cell!(
|
||||
(HeapCellValueTag::AttrVar, n) => {
|
||||
}
|
||||
(HeapCellValueTag::Lis, n) => {
|
||||
}
|
||||
(HeapCellValueTag::Var, n) => {
|
||||
}
|
||||
(HeapCellValueTag::Str, n) => {
|
||||
}
|
||||
(HeapCellValueTag::PStrOffset, n) => {
|
||||
}
|
||||
_ => {
|
||||
}
|
||||
)
|
||||
*/
|
||||
|
||||
impl PartialEq<Ref> for HeapCellValue {
|
||||
fn eq(&self, r: &Ref) -> bool {
|
||||
self.as_var() == Some(*r)
|
||||
@@ -82,7 +63,10 @@ impl PartialOrd<Ref> for HeapCellValue {
|
||||
_ => Some(Ordering::Greater),
|
||||
}
|
||||
}
|
||||
(HeapCellValueTag::Var | HeapCellValueTag::AttrVar, h1) => {
|
||||
(HeapCellValueTag::AttrVar | HeapCellValueTag::Var, h1) => {
|
||||
// _ if self.is_ref() => {
|
||||
// let h1 = self.get_value();
|
||||
|
||||
match r.get_tag() {
|
||||
RefTag::StackCell => Some(Ordering::Less),
|
||||
_ => {
|
||||
|
||||
36
src/types.rs
36
src/types.rs
@@ -343,21 +343,27 @@ impl HeapCellValue {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_string_terminator(self, heap: &[HeapCellValue]) -> bool {
|
||||
read_heap_cell!(self,
|
||||
(HeapCellValueTag::Atom, (name, arity)) => {
|
||||
name == atom!("[]") && arity == 0
|
||||
}
|
||||
(HeapCellValueTag::CStr) => {
|
||||
true
|
||||
}
|
||||
(HeapCellValueTag::PStrOffset, pstr_offset) => {
|
||||
heap[pstr_offset].get_tag() == HeapCellValueTag::CStr
|
||||
}
|
||||
_ => {
|
||||
false
|
||||
}
|
||||
)
|
||||
pub fn is_string_terminator(mut self, heap: &[HeapCellValue]) -> bool {
|
||||
loop {
|
||||
return read_heap_cell!(self,
|
||||
(HeapCellValueTag::Atom, (name, arity)) => {
|
||||
name == atom!("[]") && arity == 0
|
||||
}
|
||||
(HeapCellValueTag::CStr) => {
|
||||
true
|
||||
}
|
||||
(HeapCellValueTag::PStrLoc, h) => {
|
||||
self = heap[h];
|
||||
continue;
|
||||
}
|
||||
(HeapCellValueTag::PStrOffset, pstr_offset) => {
|
||||
heap[pstr_offset].get_tag() == HeapCellValueTag::CStr
|
||||
}
|
||||
_ => {
|
||||
false
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
||||
Reference in New Issue
Block a user