 translateIr = (ctx, irAst) ->
   walkIr irAst, (ast) ->
     if ast.ir
-      ast.ir ctx, ast
+        ast.ir ctx, ast
     else
       walked = {}
       for name, node of ast when name isnt 'js'


compileCtxAstToJsAlways = (compileFn, ctx, ast) ->
  ir = compileFn ctx, ast
  {js} = compileCtxIrToJs ctx, ir
  {ctx, ast, ir, js}

compileCtxAstToJs = (compileFn, ctx, ast) ->
  ir = compileFn ctx, ast
  if ctx.requested()
    return request: ctx.requested(), ast: ast, ir: ir
  {js} = compileCtxIrToJs ctx, ir
  {ctx, ast, ir, js}

compileCtxIrToJs = (ctx, ir) ->
  if ir
    jsIr = translateIr ctx, ir
    js = (if Array.isArray jsIr

parseExpression = (source, typedModulePath = defaultTypedModulePath) ->
  ast = (astFromSource "(#{source})", -1, -1)
  [expression] = _terms ast
  compilationFn = topLevelExpressionInModule lookupCompiledDefinitions modulePathToName typedModulePath.names
  parseWith ast, expression, compilationFn , typedModulePath, no

parseWith = (originalAst, ast, compilationFn, typedModulePath, doDeclare) ->
  if _empty _validTerms originalAst
