From: Mark Thom Date: Fri, 28 Nov 2025 05:03:56 +0000 (-0800) Subject: corrections to arithmetic expression compilation X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=refs%2Fheads%2Finstall_verify_attr_opt;p=scryer-prolog.git corrections to arithmetic expression compilation --- diff --git a/src/codegen.rs b/src/codegen.rs index 69a0d3b5..902f5b9f 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -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::(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) } _ => { diff --git a/src/lib/atts.pl b/src/lib/atts.pl index f251b57d..6d18b447 100644 --- a/src/lib/atts.pl +++ b/src/lib/atts.pl @@ -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),