]> Repositorios git - scryer-prolog.git/commitdiff
corrections to arithmetic expression compilation install_verify_attr_opt origin/install_verify_attr_opt
authorMark Thom <[email protected]>
Fri, 28 Nov 2025 05:03:56 +0000 (21:03 -0800)
committerMark Thom <[email protected]>
Fri, 28 Nov 2025 05:03:56 +0000 (21:03 -0800)
src/codegen.rs
src/lib/atts.pl

index 69a0d3b560fe4c4d023cb5668312c8ca6cb87671..902f5b9f569e3cc74bbb234423722fa33b6662bb 100644 (file)
@@ -561,11 +561,6 @@ impl CodeGenerator {
                 self.marker.reset_arg(2);
 
                 let (mut lcode, at_1) = self.compile_arith_expr(&terms[0], term_loc, 1)?;
-
-                if !matches!(terms[0], Term::Var(..)) {
-                    self.marker.advance_arg();
-                }
-
                 let (mut rcode, at_2) = self.compile_arith_expr(&terms[1], term_loc, 2)?;
 
                 code.append(&mut lcode);
@@ -855,16 +850,18 @@ impl CodeGenerator {
                 }
             }
             Term::Literal(
-                _,
+                ref cell,
                 c @ Literal::Integer(_)
                 | c @ Literal::F64(..)
                 | c @ Literal::Rational(_)
                 | c @ Literal::Fixnum(_),
             ) => {
                 let v = HeapCellValue::from(c);
-                code.push_back(instr!("put_constant", Level::Shallow, v, temp_v!(1)));
 
-                self.marker.advance_arg();
+                self.marker
+                    .mark_non_var::<QueryInstruction>(Level::Shallow, term_loc, &cell, code);
+
+                code.push_back(instr!("put_constant", Level::Shallow, v, temp_v!(1)));
                 compile_expr!(self, &terms[1], term_loc, code)
             }
             _ => {
index f251b57d9d4228c3e8169c7fd712eefe0ec67069..6d18b447cf0261dc9ee0a8625b332bb479cddc1c 100644 (file)
@@ -59,7 +59,7 @@ get_attrs_var_check(Module) -->
                              !,
                              '$get_attr_list'(Var, Ls),
                              nonvar(Ls),
-                                        atts:'$copy_attr_list'(Ls, Module, Attr))].
+                            atts:'$copy_attr_list'(Ls, Module, Attr))].
 
 put_attrs(Name/Arity, Module) -->
     put_attr(Name, Arity, Module),