summaryrefslogtreecommitdiff
path: root/src/property.ml
diff options
context:
space:
mode:
authorAlasdair2020-09-29 16:23:40 +0100
committerAlasdair2020-09-29 16:32:24 +0100
commit7441db19749fb7fb9383b6361dfbd99547e53486 (patch)
tree779f90dbe139bce648540d517be84b156d92319e /src/property.ml
parent6dbd0facf0962d869d0c3957f668b035a4a6605c (diff)
Refactor: Change AST type from a union to a struct
Diffstat (limited to 'src/property.ml')
-rw-r--r--src/property.ml6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/property.ml b/src/property.ml
index 854677c8..6a648bd8 100644
--- a/src/property.ml
+++ b/src/property.ml
@@ -53,7 +53,7 @@ open Ast_defs
open Ast_util
open Parser_combinators
-let find_properties (Defs defs) =
+let find_properties { defs; _ } =
let rec find_prop acc = function
| DEF_pragma (("property" | "counterexample") as prop_type, command, l) :: defs ->
begin match Util.find_next (function DEF_spec _ -> true | _ -> false) defs with
@@ -69,7 +69,7 @@ let find_properties (Defs defs) =
|> List.map (fun ((_, _, _, vs) as prop) -> (id_of_val_spec vs, prop))
|> List.fold_left (fun m (id, prop) -> Bindings.add id prop m) Bindings.empty
-let add_property_guards props (Defs defs) =
+let add_property_guards props ast =
let open Type_check in
let rec add_property_guards' acc = function
| (DEF_fundef (FD_aux (FD_function (r_opt, t_opt, e_opt, funcls), fd_aux) as fdef) as def) :: defs ->
@@ -118,7 +118,7 @@ let add_property_guards props (Defs defs) =
| def :: defs -> add_property_guards' (def :: acc) defs
| [] -> List.rev acc
in
- Defs (add_property_guards' [] defs)
+ { ast with defs = add_property_guards' [] ast.defs }
let rewrite defs =
add_property_guards (find_properties defs) defs