]> Repositorios git - scryer-prolog.git/commitdiff
fix use of copy_term/3 for attribute goals in toplevel (#888, #2057, #2217)
authorMark <[email protected]>
Wed, 13 Dec 2023 18:49:16 +0000 (11:49 -0700)
committerMark <[email protected]>
Wed, 13 Dec 2023 19:27:59 +0000 (12:27 -0700)
src/allocator.rs
src/toplevel.pl

index e20bf2cfde795b07ecf136d6054e4368debd1969..e961b9757a613a3634adda3626d62b14ce416877 100644 (file)
@@ -53,40 +53,5 @@ pub(crate) trait Allocator {
     fn reset_contents(&mut self);
 
     fn advance_arg(&mut self);
-
-    /*
-    fn bindings(&self) -> &AllocVarDict;
-    fn bindings_mut(&mut self) -> &mut AllocVarDict;
-    fn take_bindings(self) -> AllocVarDict;
-    */
-
     fn max_reg_allocated(&self) -> usize;
-
-    // TODO: wha.. why?? grrr. it drains the VarStatus data from vs (which it owns!)
-    // into self.bindings and perm_vs after all is computed (i.e. vs.populate_restricting_sets()
-    // and vs.set_perm_vals(has_deep_cut) have both been called).
-    /*
-    fn drain_var_data<'a>(
-        &mut self,
-        vs: VariableFixtures,
-        num_of_chunks: usize,
-    ) -> VariableFixtures {
-        let mut perm_vs = VariableFixtures::new();
-
-        for (var, var_status) in vs.into_iter() {
-            match var_status {
-                VarStatus::Temp(chunk_num, tvd) => {
-                    self.bindings_mut()
-                        .insert(var.clone(), VarAlloc::Temp(chunk_num, 0, tvd));
-                }
-                VarStatus::Perm(_) => {
-                    self.bindings_mut().insert(var.clone(), VarAlloc::Perm(0));
-                    perm_vs.insert(var, var_status);
-                }
-            };
-        }
-
-        perm_vs
-    }
-    */
 }
index a9a423c45af5bf6c6c2741e86a4fa479fbdb4ec9..4e242076682c555af3d5cb8774542cafcaaa33b7 100644 (file)
@@ -314,7 +314,9 @@ write_eqs_and_read_input(B, VarList, AttrVars) :-
     % one layer of depth added for (=/2) functor
     '$term_variables_under_max_depth'(OrigVars, 22, Vars0),
     '$project_atts':project_attributes(Vars0, AttrVars),
-    copy_term(AttrVars, AttrVars, AttrGoals),
+    % need to copy all the visible Vars here so that they appear
+    % properly in AttrGoals, even the non-attributed.
+    copy_term(Vars0, Vars0, AttrGoals),
     term_variables(AttrGoals, AttrGoalVars),
     append([Vars0, AttrGoalVars, AttrVars], Vars),
     charsio:extend_var_list(Vars, VarList, NewVarList, fabricated),