lib/bmg/operator/constants.rb in bmg-0.4.0 vs lib/bmg/operator/constants.rb in bmg-0.4.1

- old
+ new

@@ -34,21 +34,23 @@ end protected ### optimization def _restrict(type, predicate) + # bottom_p makes no reference to constants, top_p possibly + # does... top_p, bottom_p = predicate.and_split(constants.keys) if top_p.tautology? - # push all situation + # push all situation: predicate made no reference to constants result = operand - result = result.restrict(bottom_p) unless bottom_p.tautology? + result = result.restrict(bottom_p) result = result.constants(constants) result elsif (top_p.free_variables - constants.keys).empty? # top_p applies to constants only if eval = top_p.evaluate(constants) result = operand - result = result.restrict(bottom_p) unless bottom_p.tautology? + result = result.restrict(bottom_p) result = result.constants(constants) result else Relation.empty(type) end