From 938da825d3a4d3239b132a5e8047f558bca6507f Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Mon, 10 Feb 2014 09:42:34 +0000 Subject: [PATCH] add Async_kernel.Ivar.Deferred.t to the async hack Fixes janestreet/async_kernel#2 --- src/lib/uTop_main.ml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/uTop_main.ml b/src/lib/uTop_main.ml index 5aa7a22..4d6bbae 100644 --- a/src/lib/uTop_main.ml +++ b/src/lib/uTop_main.ml @@ -340,7 +340,7 @@ type rewrite_rule = { let rewrite_rules : (Longident.t, rewrite_rule) Hashtbl.t = Hashtbl.create 42 let longident_lwt_main_run = Longident.Ldot (Longident.Lident "Lwt_main", "run") -let longident_async_core_thread_safe_block_on_async_exn = +let longident_async_thread_safe_block_on_async_exn = Longident.parse "Async.Std.Thread_safe.block_on_async_exn" let longident_unit = Longident.Lident "()" @@ -372,20 +372,22 @@ let () = }; (* Rewrite Async.Std.Defered.t expressions to - Async_core.Thread_safe.block_on_async_exn (fun () -> ). *) - Hashtbl.add rewrite_rules (Longident.parse "Async_core.Ivar.Deferred.t") { - required_values = [longident_async_core_thread_safe_block_on_async_exn]; + Async.Std.Thread_safe.block_on_async_exn (fun () -> ). *) + let rule = { + required_values = [longident_async_thread_safe_block_on_async_exn]; rewrite = (fun loc e -> { Parsetree.pexp_desc = Parsetree.Pexp_apply ({ Parsetree.pexp_desc = Parsetree.Pexp_ident - (with_loc loc longident_async_core_thread_safe_block_on_async_exn); + (with_loc loc longident_async_thread_safe_block_on_async_exn); Parsetree.pexp_loc = loc }, [("", wrap_unit loc e)]); Parsetree.pexp_loc = loc; }); enabled = UTop.auto_run_async; - } + } in + Hashtbl.add rewrite_rules (Longident.parse "Async_core.Ivar.Deferred.t") rule; + Hashtbl.add rewrite_rules (Longident.parse "Async_kernel.Ivar.Deferred.t") rule (* Returns whether the argument is a toplevel expression. *) let is_eval = function