dereference variables when looking for string terminators
This commit is contained in:
12
src/types.rs
12
src/types.rs
@@ -344,6 +344,8 @@ impl HeapCellValue {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_string_terminator(mut self, heap: &[HeapCellValue]) -> bool {
|
pub fn is_string_terminator(mut self, heap: &[HeapCellValue]) -> bool {
|
||||||
|
use crate::machine::heap::*;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
return read_heap_cell!(self,
|
return read_heap_cell!(self,
|
||||||
(HeapCellValueTag::Atom, (name, arity)) => {
|
(HeapCellValueTag::Atom, (name, arity)) => {
|
||||||
@@ -356,6 +358,16 @@ impl HeapCellValue {
|
|||||||
self = heap[h];
|
self = heap[h];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
(HeapCellValueTag::AttrVar | HeapCellValueTag::Var, h) => {
|
||||||
|
let cell = heap_bound_store(heap, heap_bound_deref(heap, heap[h]));
|
||||||
|
|
||||||
|
if cell.is_var() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
self = cell;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
(HeapCellValueTag::PStrOffset, pstr_offset) => {
|
(HeapCellValueTag::PStrOffset, pstr_offset) => {
|
||||||
heap[pstr_offset].get_tag() == HeapCellValueTag::CStr
|
heap[pstr_offset].get_tag() == HeapCellValueTag::CStr
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user