]> Repositorios git - scryer-prolog.git/commitdiff
clean up print_list_like
authorMark Thom <[email protected]>
Tue, 14 Apr 2020 20:26:30 +0000 (14:26 -0600)
committerMark Thom <[email protected]>
Tue, 14 Apr 2020 20:26:30 +0000 (14:26 -0600)
src/prolog/heap_print.rs

index 16efd61c012d93762b10f992508009b423220f65..186a21286f662dc31663de2124adbf3ce8c04feb 100644 (file)
@@ -1057,10 +1057,10 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
         addr: Addr,
         mut max_depth: usize,
     ) {
-        let a1 = iter.stack().pop();
-        let a2 = iter.stack().pop();
-
         if self.check_max_depth(&mut max_depth) {
+            iter.stack().pop();
+            iter.stack().pop();
+
             self.state_stack.push(TokenOrRedirect::Atom(clause_name!("...")));
             return;
         }
@@ -1071,13 +1071,13 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
         let buf = heap_pstr_iter.to_string();
 
         if buf.is_empty() {
-            iter.stack().push(a2.unwrap());
-            iter.stack().push(a1.unwrap());
-
             self.push_list(iter, max_depth);
             return;
         }
 
+        iter.stack().pop();
+        iter.stack().pop();
+
         let end_addr = heap_pstr_iter.focus();
 
         let at_cdr = self.at_cdr(",");
@@ -1349,7 +1349,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
                 if self.ignore_ops {
                     self.format_struct(iter, max_depth, 2, clause_name!("."));
                 } else {
-                    self.print_list_like(iter, Addr::Lis(l), max_depth); //self.push_list(iter, max_depth);
+                    self.print_list_like(iter, Addr::Lis(l), max_depth);
                 }
             }
             &HeapCellValue::Addr(addr) => {