Skip to content

Commit

Permalink
emit the dep fns info into a top level json array 'nested_functions'
Browse files Browse the repository at this point in the history
  • Loading branch information
snapdgn committed May 23, 2024
1 parent f8ed024 commit 39bd00e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sail_json_backend/json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ let json_of_extensions k =
None -> ""
| Some (l) -> String.concat "," l

let json_of_dependent_functions = ()

let json_of_instruction k v =
"{\n" ^
" \"mnemonic\": " ^ (json_of_mnemonic (List.hd v)) ^ ",\n" ^
Expand Down Expand Up @@ -670,5 +672,12 @@ let defs { defs; _ } =
print_endline " \"extensions\": [";
let extension_list = Hashtbl.fold (fun k v accum -> v :: accum) extensions [] in
print_endline (String.concat ",\n" (List.sort_uniq String.compare (List.concat extension_list)));
print_endline " ],";

print_endline " \"nested_functions\": [";
Hashtbl.iter (fun name source ->
print_endline (" {\n \"name\": \"" ^ name ^ "\",");
print_endline (" \"source\": \"" ^ String.escaped source ^ "\"\n },")
) nested_functions;
print_endline " ]";
print_endline "}";

0 comments on commit 39bd00e

Please sign in to comment.