]> Repositorios git - scryer-prolog.git/commitdiff
dereference car of Lis in HeapPStRIter::step (#1238)
authorMark Thom <[email protected]>
Thu, 20 Jan 2022 03:51:23 +0000 (20:51 -0700)
committerMark Thom <[email protected]>
Thu, 20 Jan 2022 03:51:23 +0000 (20:51 -0700)
src/machine/partial_string.rs
tests/scryer/src_tests.rs

index 4430b9e3ffd12c5ba97c391702eaee313a9d1594..ed1ad919b728ff8fcac6983bf818321f7715ecc2 100644 (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,
index 56aa7374d16cf84cc1a3a62c5c0b23c5fae88aba..24259f3adbfa32fe4e0a2b035401315595bdae74 100644 (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"
     );
 }