instantiate variables in numerical comparisons

This commit is contained in:
Mark Thom
2019-04-22 18:54:03 -06:00
parent 29848a51ee
commit f745b077a9
2 changed files with 10 additions and 2 deletions

View File

@@ -304,6 +304,14 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<TermMarker>
{ {
match ct { match ct {
&InlinedClauseType::CompareNumber(cmp, ..) => { &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 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)?; let (mut rcode, at_2) = self.call_arith_eval(terms[1].as_ref(), 2)?;

View File

@@ -251,7 +251,7 @@ pub enum EvalError {
// FloatOverflow, // FloatOverflow,
// IntOverflow, // IntOverflow,
// Undefined, // Undefined,
// Underflow, // FloatUnderflow,
ZeroDivisor, ZeroDivisor,
NoRoots NoRoots
} }
@@ -262,7 +262,7 @@ impl EvalError {
// EvalError::FloatOverflow => "float_overflow", // EvalError::FloatOverflow => "float_overflow",
// EvalError::IntOverflow => "int_overflow", // EvalError::IntOverflow => "int_overflow",
// EvalError::Undefined => "undefined", // EvalError::Undefined => "undefined",
// EvalError::Underflow => "underflow", // EvalError::FloatUnderflow => "underflow",
EvalError::ZeroDivisor => "zero_divisor", EvalError::ZeroDivisor => "zero_divisor",
EvalError::NoRoots => "no_roots" EvalError::NoRoots => "no_roots"
} }