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_cases((Module:Goals0), _, ExpandedGoals, HeadVars) :-
|
||||||
expand_goal(Goals0, Module, Goals1, HeadVars),
|
expand_goal(Goals0, Module, Goals1, HeadVars),
|
||||||
ExpandedGoals = (Module:Goals1).
|
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) :-
|
expand_goal(UnexpandedGoals, Module, ExpandedGoals, HeadVars) :-
|
||||||
( var(UnexpandedGoals) ->
|
( 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),
|
; goal_expansion(UnexpandedGoals, Module, UnexpandedGoals1),
|
||||||
( Module \== user ->
|
( Module \== user ->
|
||||||
goal_expansion(UnexpandedGoals1, user, Goals)
|
goal_expansion(UnexpandedGoals1, user, Goals)
|
||||||
|
|||||||
@@ -45,25 +45,6 @@ pub enum TermOrderCategory {
|
|||||||
Compound,
|
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 {
|
impl PartialEq<Ref> for HeapCellValue {
|
||||||
fn eq(&self, r: &Ref) -> bool {
|
fn eq(&self, r: &Ref) -> bool {
|
||||||
self.as_var() == Some(*r)
|
self.as_var() == Some(*r)
|
||||||
@@ -82,7 +63,10 @@ impl PartialOrd<Ref> for HeapCellValue {
|
|||||||
_ => Some(Ordering::Greater),
|
_ => 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() {
|
match r.get_tag() {
|
||||||
RefTag::StackCell => Some(Ordering::Less),
|
RefTag::StackCell => Some(Ordering::Less),
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
36
src/types.rs
36
src/types.rs
@@ -343,21 +343,27 @@ impl HeapCellValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_string_terminator(self, heap: &[HeapCellValue]) -> bool {
|
pub fn is_string_terminator(mut self, heap: &[HeapCellValue]) -> bool {
|
||||||
read_heap_cell!(self,
|
loop {
|
||||||
(HeapCellValueTag::Atom, (name, arity)) => {
|
return read_heap_cell!(self,
|
||||||
name == atom!("[]") && arity == 0
|
(HeapCellValueTag::Atom, (name, arity)) => {
|
||||||
}
|
name == atom!("[]") && arity == 0
|
||||||
(HeapCellValueTag::CStr) => {
|
}
|
||||||
true
|
(HeapCellValueTag::CStr) => {
|
||||||
}
|
true
|
||||||
(HeapCellValueTag::PStrOffset, pstr_offset) => {
|
}
|
||||||
heap[pstr_offset].get_tag() == HeapCellValueTag::CStr
|
(HeapCellValueTag::PStrLoc, h) => {
|
||||||
}
|
self = heap[h];
|
||||||
_ => {
|
continue;
|
||||||
false
|
}
|
||||||
}
|
(HeapCellValueTag::PStrOffset, pstr_offset) => {
|
||||||
)
|
heap[pstr_offset].get_tag() == HeapCellValueTag::CStr
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|||||||
Reference in New Issue
Block a user