summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Ho2022-01-29 14:23:49 +0100
committerSon Ho2022-01-29 14:23:49 +0100
commit59655243ec2ceb409e4d1ab6ecfb33ff6b9027f9 (patch)
treec7872ff953c122a2e77e974ff1a0ace30b73300e
parentf84595dc2e717be3cf3f5562715b602e69c0257a (diff)
Add a "name" field in Module
-rw-r--r--src/CfimOfJson.ml4
-rw-r--r--src/Modules.ml1
2 files changed, 4 insertions, 1 deletions
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;