 getToken = (word) -> word.token
 
 compileFnImpl = (body, wheres, doReturn) ->
-  if not body
-    throw new Error "Missing definition of a function"
-  # Find invalid (hoistable) wheres and let the function body
-  # define them
-  [validWheres, hoistableWheres] = findHoistableWheres wheres
-  wheresDef = compileWhereImpl validWheres
-  bodyDef = compileImpl body, hoistableWheres
+  [wheresDef, bodyDef] = compileFnImplParts body, wheres
   [
     wheresDef
   ,

    else
      bodyDef
  ].join '\n'

# Returns two lists, first the wheres that can be defined, second
# the wheres which use an identifier which is not in scope (possibly

  variableCounter = 1
  compileTop preCompileTop source

# list of definitions followed by an expression, returns only
# the expression part
compiledBottom = (source) ->
  variableCounter = 1
  compileBottom preCompileBottom source
