   ]
 
 graphToWheres = (graph) ->
-  graph.map ({def}) -> def
+  graph.map ({def: [pattern, def], missing}) -> [pattern, def, missing]
 
 # Returns two new graphs, one which needs hoisting and one which doesnt
 findHoistableWheres = ([graph, lookupTable]) ->

hoistWheres = (possible, assigns) ->
  defined = (n for [n, _] in assigns)
  hoisted = []
  for [pattern, def, names] in possible
    canHoist = yes
    for name in names when name not in defined
      canHoist = no
    if canHoist
      hoisted.push [pattern, def]
  if hoisted.length > 0
    compileWhereImpl hoisted
  else
    ''

toJsString = (token) ->
  "'#{token}'"

    throw new Error "Missing definition of a function"
  # Find invalid (hoistable) wheres and let the function body
  # define them
  log printAst wheres
  if (unpairs wheres).length % 2 != 0
    throw new Error "Missing definition for last assignement inside function"
  [readyWheres, hoistableWheres] = wheresWithHoisting wheres
  addToScopeAllNames readyWheres
  wheresDef = (graphToWheres readyWheres).map(compileDef).join '\n'
  bodyDef = compileImpl body, graphToWheres hoistableWheres
  [wheresDef, bodyDef]

unpairs = (pairs) ->
  unpaired = []
  for [a, b] in pairs
    unpaired.push a if a?
    unpaired.push b if b?
  unpaired

addToScopeAllNames = (graph) ->
  for {names, def: [pattern, def]} in graph
