dereference car of Lis in HeapPStRIter::step (#1238)

This commit is contained in:
Mark Thom
2022-01-19 20:51:23 -07:00
parent 1854338ff4
commit 5dddf0a460
2 changed files with 15 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
use crate::atom_table::*;
use crate::parser::ast::*;
use crate::machine::heap::*;
use crate::machine::machine_errors::CycleSearchResult;
use crate::machine::system_calls::BrentAlgState;
use crate::types::*;
@@ -296,7 +297,12 @@ impl<'a> HeapPStrIter<'a> {
};
}
(HeapCellValueTag::Lis, h) => {
return if let Some(c) = self.heap[h].as_char() {
let value = heap_bound_store(
self.heap,
heap_bound_deref(self.heap, self.heap[h]),
);
return if let Some(c) = value.as_char() {
Some(PStrIterStep {
iteratee: PStrIteratee::Char(curr_hare, c),
next_hare: h+1,
@@ -310,7 +316,12 @@ impl<'a> HeapPStrIter<'a> {
.get_name_and_arity();
return if name == atom!(".") && arity == 2 {
if let Some(c) = self.heap[s+1].as_char() {
let value = heap_bound_store(
self.heap,
heap_bound_deref(self.heap, self.heap[s+1]),
);
if let Some(c) = value.as_char() {
Some(PStrIterStep {
iteratee: PStrIteratee::Char(curr_hare, c),
next_hare: s+2,

View File

@@ -51,7 +51,7 @@ fn rules() {
fn setup_call_cleanup_load() {
load_module_test(
"src/tests/setup_call_cleanup.pl",
"1+21+31+2>_14313+_143141+_129071+2>41+2>_143141+2>31+2>31+2>4ba"
"1+21+31+2>_14219+_142201+_128131+2>41+2>_142201+2>31+2>31+2>4ba"
);
}
@@ -60,7 +60,7 @@ fn setup_call_cleanup_process() {
run_top_level_test_with_args(
&["src/tests/setup_call_cleanup.pl", "-f", "-g", "halt"],
"",
"1+21+31+2>_15712+_157131+_143061+2>41+2>_157131+2>31+2>31+2>4ba",
"1+21+31+2>_15618+_156191+_142121+2>41+2>_156191+2>31+2>31+2>4ba"
);
}