Skip to content

Commit

Permalink
dune fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed Dec 18, 2024
1 parent 1667793 commit 97db383
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions engine/lib/ast_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 =
Expand Down

0 comments on commit 97db383

Please sign in to comment.