         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) ->

    independent.push node
    delete dependencies[name] for name in node.names

  for parent in graph when parent.set.numDependencies is 0
    moveToIndependent parent

  sorted = []

  validIdentifier node.token

hoistWheres = (hoistable, assigns) ->
  defined = addAllToSet newSet(), (n for [n, _] in assigns)
  hoistedNames = newSet()
  hoisted = []
  notHoisted = []
  for where in hoistable
    {missing, names, def, set} = where
    stillMissingNames = addAllToSet newSet(),
      (name for name in (setToArray missing) when not inSet defined, name)
    stillMissingDeps = removeAllFromSet (cloneSet set), setToArray hoistedNames
    if stillMissingNames.size == 0 and stillMissingDeps.size == 0
      hoisted.push def
      addAllToSet hoistedNames, names
    else
      notHoisted.push
        def: def
