         definingScope = lookupIdentifier token, node
         parent = lookupByName[token]
         if parent
-          addDependency child.set, name for name in parent.names unless child is parent
-          addDependency deps, parent
+          addToSet child.set, name for name in parent.names unless child is parent
+          addToSet deps, parent
         else if isReference(node) and !lookupIdentifier token, node
-          addDependency child.missing, node.token
+          addToSet child.missing, node.token
   [graph, lookupByName]
 
 lookupTableForGraph = (graph) ->

#   Map (name -> GraphElement)
constructDependencyGraph = (wheres) ->
  lookupByName = {}
  deps = dependencySet()
  # find all defined names
  graph = for [pattern, def], i in wheres
    def: [pattern, def]
    set: dependencySet()
    names: findNames pattern
    missing: dependencySet()

  lookupByName = lookupTableForGraph graph


reverseGraph = (nodes) ->
  reversed = {}
  for child in nodes
    for dependencyName of child.set.values
      (reversed[dependencyName] ?= []).push child
  reversed

