]> Repositorios git - scryer-prolog.git/commitdiff
add stream alias check to atom/1 (#1855)
authorMark <[email protected]>
Thu, 6 Jul 2023 17:38:12 +0000 (11:38 -0600)
committerMark <[email protected]>
Thu, 6 Jul 2023 17:38:12 +0000 (11:38 -0600)
src/machine/dispatch.rs

index ba13cf5b993e042880133cb2f2f8fa42bf6a2543..11e6d95d4d491997356c8a86627607d4d79e4f49 100644 (file)
@@ -2376,6 +2376,20 @@ impl Machine {
                         (HeapCellValueTag::Char) => {
                             self.machine_st.p += 1;
                         }
+                        (HeapCellValueTag::Cons, c) => {
+                            match_untyped_arena_ptr!(c,
+                               (ArenaHeaderTag::Stream, stream) => {
+                                   if stream.options().get_alias().is_none() {
+                                       self.machine_st.backtrack();
+                                   } else {
+                                       self.machine_st.p += 1;
+                                   }
+                               }
+                               _ => {
+                                   self.machine_st.backtrack();
+                               }
+                            );
+                        }
                         _ => {
                             self.machine_st.backtrack();
                         }
@@ -2405,6 +2419,20 @@ impl Machine {
                         (HeapCellValueTag::Char) => {
                             self.machine_st.p = self.machine_st.cp;
                         }
+                        (HeapCellValueTag::Cons, c) => {
+                            match_untyped_arena_ptr!(c,
+                               (ArenaHeaderTag::Stream, stream) => {
+                                   if stream.options().get_alias().is_none() {
+                                       self.machine_st.backtrack();
+                                   } else {
+                                       self.machine_st.p = self.machine_st.cp;
+                                   }
+                               }
+                               _ => {
+                                   self.machine_st.backtrack();
+                               }
+                            );
+                        }
                         _ => {
                             self.machine_st.backtrack();
                         }