From 97db38379df72b91dfc44ca21de4d36deee1c9ca Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Wed, 18 Dec 2024 15:27:45 +0100 Subject: [PATCH] dune fmt --- engine/lib/ast_utils.ml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/engine/lib/ast_utils.ml b/engine/lib/ast_utils.ml index 2532176c6..2aa8b2956 100644 --- a/engine/lib/ast_utils.ml +++ b/engine/lib/ast_utils.ml @@ -954,6 +954,7 @@ module Make (F : Features.T) = struct (** Prints an expression pretty-printed as Rust, with its full AST encoded as JSON, available as a file, so that one can `jless` or `jq` into it. *) + val item' : ?label:string -> AST.item -> string val item : ?label:string -> AST.item -> unit end = struct @@ -968,15 +969,16 @@ module Make (F : Features.T) = struct |> Stdio.prerr_endline let item' ?(label = "") (e : AST.item) : string = - let path = tempfile_path ~suffix:".json" in - Core.Out_channel.write_all path - ~data:([%yojson_of: AST.item] e |> Yojson.Safe.pretty_to_string); - let e = LiftToFullAst.item e in - "```rust " ^ label ^ "\n" ^ Print_rust.pitem_str e - ^ "\n```\x1b[34m JSON-encoded AST available at \x1b[1m" ^ path - ^ "\x1b[0m (hint: use `jless " ^ path ^ "`)" - - let item ?(label = "") (e : AST.item) = item' ~label e |> Stdio.prerr_endline + let path = tempfile_path ~suffix:".json" in + Core.Out_channel.write_all path + ~data:([%yojson_of: AST.item] e |> Yojson.Safe.pretty_to_string); + let e = LiftToFullAst.item e in + "```rust " ^ label ^ "\n" ^ Print_rust.pitem_str e + ^ "\n```\x1b[34m JSON-encoded AST available at \x1b[1m" ^ path + ^ "\x1b[0m (hint: use `jless " ^ path ^ "`)" + + let item ?(label = "") (e : AST.item) = + item' ~label e |> Stdio.prerr_endline end let unbox_expr' (next : expr -> expr) (e : expr) : expr =