]> Repositorios git - scryer-prolog.git/commitdiff
instantiate variables in numerical comparisons
authorMark Thom <[email protected]>
Tue, 23 Apr 2019 00:54:03 +0000 (18:54 -0600)
committerMark Thom <[email protected]>
Tue, 23 Apr 2019 00:54:03 +0000 (18:54 -0600)
src/prolog/codegen.rs
src/prolog/machine/machine_errors.rs

index 9d84e1d268008ebde05e8cccf46d0a0da5f3e45e..ad2d8f7b492a0a747806c22e2c0bdf1c71ef629f 100644 (file)
@@ -304,6 +304,14 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<TermMarker>
     {
         match ct {
             &InlinedClauseType::CompareNumber(cmp, ..) => {
+                if let &Term::Var(ref vr, ref name) = terms[0].as_ref() {
+                    self.mark_non_callable(name.clone(), 2, term_loc, vr, code);                    
+                }
+
+                if let &Term::Var(ref vr, ref name) = terms[1].as_ref() {
+                    self.mark_non_callable(name.clone(), 2, term_loc, vr, code);                    
+                }
+                
                 let (mut lcode, at_1) = self.call_arith_eval(terms[0].as_ref(), 1)?;
                 let (mut rcode, at_2) = self.call_arith_eval(terms[1].as_ref(), 2)?;
 
index b37fb6377aad29bb28eafcc99b9f371d5a01852d..ddff619ff3825c187d859249f68cad7732249c4a 100644 (file)
@@ -251,7 +251,7 @@ pub enum EvalError {
 //    FloatOverflow,
 //    IntOverflow,
 //    Undefined,
-//    Underflow,
+//    FloatUnderflow,
     ZeroDivisor,
     NoRoots
 }
@@ -262,7 +262,7 @@ impl EvalError {
 //            EvalError::FloatOverflow => "float_overflow",
 //            EvalError::IntOverflow => "int_overflow",
 //            EvalError::Undefined => "undefined",
-//            EvalError::Underflow => "underflow",
+//            EvalError::FloatUnderflow => "underflow",
             EvalError::ZeroDivisor => "zero_divisor",
             EvalError::NoRoots => "no_roots"
         }