From 59655243ec2ceb409e4d1ab6ecfb33ff6b9027f9 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Sat, 29 Jan 2022 14:23:49 +0100 Subject: Add a "name" field in Module --- src/CfimOfJson.ml | 4 +++- src/Modules.ml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CfimOfJson.ml b/src/CfimOfJson.ml index dddfbd58..82f9d95a 100644 --- a/src/CfimOfJson.ml +++ b/src/CfimOfJson.ml @@ -632,14 +632,16 @@ let cfim_module_of_json (js : json) : (M.cfim_module, string) result = (match js with | `Assoc [ + ("name", name); ("declarations", declarations); ("types", types); ("functions", functions); ] -> + let* name = string_of_json name in let* declarations = list_of_json declaration_group_of_json declarations in let* types = list_of_json type_def_of_json types in let* functions = list_of_json fun_def_of_json functions in - Ok { M.declarations; types; functions } + Ok { M.name; declarations; types; functions } | _ -> Error "") diff --git a/src/Modules.ml b/src/Modules.ml index ef4998ec..1199d74a 100644 --- a/src/Modules.ml +++ b/src/Modules.ml @@ -15,6 +15,7 @@ type declaration_group = [@@deriving show] type cfim_module = { + name : string; declarations : declaration_group list; types : type_def list; functions : fun_def list; -- cgit v1.2.3