   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) ->
-    refs = []
-    for ref in node.left.visit @
-      refs.push ref if -1 is refs.indexOf ref
-    for ref in node.right.visit @
-      refs.push ref if -1 is refs.indexOf ref
-    refs
+    @visitInfixExpression node
 
 evaluate = (f, data) ->
   f.visit new Evaluator data

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

getComparator = (comparator) ->
  switch comparator

    @visitLiteral node
  visitParens: (node) ->
    node.formula.visit @
  visitInfixExpression: (node, fn) ->
    left = node.left.visit @
    right = node.right.visit @
    fn left, right

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