diff options
author | Son Ho | 2022-01-03 16:38:40 +0100 |
---|---|---|
committer | Son Ho | 2022-01-03 16:38:40 +0100 |
commit | cac93f3147ddf259e90172e9f7e993ca324944e0 (patch) | |
tree | a41043d70dc0035688515047857629905b5bba36 | |
parent | 646f3fde0b5156eaebdc7dfb6003fca1041482df (diff) |
Implement rty_regions
Diffstat (limited to '')
-rw-r--r-- | src/Interpreter.ml | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Interpreter.ml b/src/Interpreter.ml index 68b92361..a5d414aa 100644 --- a/src/Interpreter.ml +++ b/src/Interpreter.ml @@ -648,9 +648,20 @@ let region_in_set (r : T.RegionId.id T.region) (rset : T.RegionId.set_t) : bool (** Return the set of regions in an rty *) let rty_regions (ty : T.rty) : T.RegionId.set_t = let s = ref T.RegionId.Set.empty in - let add_region r = s := T.RegionId.Set.add r !s in + let add_region (r : T.RegionId.id T.region) = + match r with T.Static -> () | T.Var rid -> s := T.RegionId.Set.add rid !s + in + let obj = + object + inherit [_] T.iter_ty - raise Unimplemented + method! visit_'r _env r = add_region r + end + in + (* Explore the type *) + obj#visit_ty () ty; + (* Return the set of accumulated regions *) + !s let rty_regions_intersect (ty : T.rty) (regions : T.RegionId.set_t) : bool = let ty_regions = rty_regions ty in |