     end)
   end
 
-  defp do_execute(module, pid) do
-    result =
-      case ModuleState.get_in_memory_module(pid, module) do
-        nil ->
-          ElixirScript.Beam.debug_info(module)
-
-        beam ->
-          ElixirScript.Beam.debug_info(beam)
-      end
-
+  defp do_execute(module, result, pid) do
     case result do
       {:ok, info} ->
         walk_module(module, info, pid)

        raise ElixirScript.CompileError,
          message: "An error occurred while compiling #{inspect(module)}: #{error}",
          severity: :error
    end
  end



  defp walk({:., _, [module, function]}, state) do
    if ElixirScript.Translate.Module.is_elixir_module(module) do
      if ModuleState.get_module(state.pid, module) == nil do
        case get_debug_info(module, state.pid) do
          {:ok, _} = result ->
            ModuleState.put_used_module(state.pid, state.module, module)
            do_execute(module, result, state.pid)

          result ->
            do_execute(module, result, state.pid)
        end
      else
        ModuleState.put_used_module(state.pid, state.module, module)
      end
    else
      walk(module, state)
