   visitReference: (node) ->
     @data[node.name]
   visitComparison: (node) ->
-    left = node.left.visit @
-    right = node.right.visit @
-    comparator = getComparator node.comparator
-    comparator left, right
+    @visitInfixExpression node, getComparator node.comparator
 
 getComparator = (comparator) ->
   switch comparator

    @visitLiteral node
  visitParens: (node) ->
    node.formula.visit @

class Evaluator extends FormulaVisitor
  constructor: (@data) ->

  constructor: ->
  visitLiteral: ->
    []
  visitInfixExpression: (node) ->
    super node, (left, right) ->
      refs = []
      for ref in left
        refs.push ref if -1 is refs.indexOf ref
      for ref in right
        refs.push ref if -1 is refs.indexOf ref
      refs

  visitReference: (node) ->
    [node.name]
  visitComparison: (node) ->
    @visitInfixExpression node

evaluate = (f, data) ->
  f.visit new Evaluator data
