]> Repositorios git - scryer-prolog.git/commitdiff
add support for copying attributed variables in copy_term
authorMark Thom <[email protected]>
Tue, 5 Feb 2019 05:56:23 +0000 (22:56 -0700)
committerMark Thom <[email protected]>
Tue, 5 Feb 2019 05:56:23 +0000 (22:56 -0700)
src/prolog/copier.rs

index cc910200832967a5dfee597c7f576dfc93c532f2..a635ff764dc9d59841aa8d32f406e84d5e27e4ae 100644 (file)
@@ -118,18 +118,14 @@ pub(crate) trait CopierTarget: IndexMut<usize, Output=HeapCellValue>
                                     scan += 1;
                                 },
                                 Addr::AttrVar(h) if ra == rd => {
-                                    let threshold = self.threshold();
-                                    
+                                    let threshold = self.threshold();                                   
                                     self.push(HeapCellValue::Addr(Addr::AttrVar(threshold)));
 
                                     let list_val = self[h+1].clone();
                                     self.push(list_val);
 
+                                    self.reinstantiate_var(ra, threshold, &mut trail);
                                     self[scan] = HeapCellValue::Addr(Addr::AttrVar(threshold));
-                                    self[h] = HeapCellValue::Addr(Addr::AttrVar(threshold));
-                                    
-                                    trail.push((Ref::AttrVar(h),
-                                                HeapCellValue::Addr(Addr::AttrVar(h))));                                    
                                 },
                                 _ if ra == rd => {
                                     self.reinstantiate_var(ra, scan, &mut trail);