Skip to content

Commit

Permalink
handle module deps from other context in genjson
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Jul 18, 2023
1 parent 8c747ee commit 58daf01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/context/display/displayJson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,14 @@ let handler =
"server/module", (fun hctx ->
let sign = Digest.from_hex (hctx.jsonrpc#get_string_param "signature") in
let path = Path.parse_path (hctx.jsonrpc#get_string_param "path") in
let cc = hctx.display#get_cs#get_context sign in
let cs = hctx.display#get_cs in
let cc = cs#get_context sign in
let m = try
cc#find_module path
with Not_found ->
hctx.send_error [jstring "No such module"]
in
hctx.send_result (generate_module cc m)
hctx.send_result (generate_module cs cc m)
);
"server/type", (fun hctx ->
let sign = Digest.from_hex (hctx.jsonrpc#get_string_param "signature") in
Expand Down
7 changes: 3 additions & 4 deletions src/core/json/genjson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ let generate_module_type ctx mt =

(* module *)

let generate_module cc m =
let generate_module cs cc m =
jobject [
"id",jint m.m_id;
"path",generate_module_path m.m_path;
Expand All @@ -718,11 +718,10 @@ let generate_module cc m =
| MSGood -> "Good"
| MSBad reason -> Printer.s_module_skip_reason reason
| MSUnknown -> "Unknown");
"dependencies",jarray (PMap.fold (fun (_,mpath) acc ->
"dependencies",jarray (PMap.fold (fun (sign,mpath) acc ->
(jobject [
"path",jstring (s_type_path mpath);
(* TODO handle modules from another context here *)
"sign",jstring (Digest.to_hex (cc#find_module mpath).m_extra.m_sign);
"sign",jstring (Digest.to_hex ((cs#get_context sign)#find_module mpath).m_extra.m_sign);
]) :: acc
) m.m_extra.m_deps []);
"dependents",jarray (List.map (fun m -> (jobject [
Expand Down

0 comments on commit 58daf01

Please sign in to comment.