Skip to content

Commit

Permalink
Use mdep.md_kind instead of signature
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed May 15, 2024
1 parent 4225bb9 commit 5c9efe8
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/codegen/codegen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -386,29 +386,16 @@ module Dump = struct
let buf,close = create_dumpfile [] dump_dependencies_path in
let print fmt = Printf.kprintf (fun s -> Buffer.add_string buf s) fmt in
let dep = Hashtbl.create 0 in

let com_sign = Define.get_signature com.defines in
let macro_sign =
if com.is_macro_context then None
else Option.map (fun com -> (com, Define.get_signature com.defines)) (com.get_macros())
in
let find_module path sign =
let com = match macro_sign with
| _ when sign = com_sign -> com
| Some (com, macro_sign) when sign = macro_sign -> com
| _ -> raise Not_found
in
(com, com.module_lut#find path)
in
List.iter (fun m ->
print "%s:\n" (Path.UniqueKey.lazy_path m.m_extra.m_file);
PMap.iter (fun _ mdep ->
let (com, m2) = find_module mdep.md_path mdep.md_sign in
let file = Path.UniqueKey.lazy_path m2.m_extra.m_file in
let ctx = match platform_name_macro com with
| p when p <> target_name -> Printf.sprintf "[%s] " p
| _ -> ""
let (ctx,m2) = match mdep.md_kind with
| MMacro when not com.is_macro_context ->
("[macro] ", (Option.get (com.get_macros())).module_lut#find mdep.md_path)
| _ ->
("", com.module_lut#find mdep.md_path)
in
let file = Path.UniqueKey.lazy_path m2.m_extra.m_file in
print "\t%s%s\n" ctx file;
let l = try Hashtbl.find dep file with Not_found -> [] in
Hashtbl.replace dep file (m :: l)
Expand Down

0 comments on commit 5c9efe8

Please sign in to comment.