diff options
author | Son Ho | 2022-01-06 18:20:24 +0100 |
---|---|---|
committer | Son Ho | 2022-01-06 18:20:24 +0100 |
commit | f3982cbe9782405b50b04c948ba7cb0bd89ef85f (patch) | |
tree | 2df26310f1e67980a8b6f6ff278bd71bf0791eb4 /src/Substitute.ml | |
parent | 7137e0733650e0ce37eff4ff805c95543f2c1161 (diff) |
Make the symbolic, borrow, region and abstration counters global and
stateful
Diffstat (limited to 'src/Substitute.ml')
-rw-r--r-- | src/Substitute.ml | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Substitute.ml b/src/Substitute.ml index 1b6003bb..62a737ad 100644 --- a/src/Substitute.ml +++ b/src/Substitute.ml @@ -42,16 +42,12 @@ let erase_regions (ty : T.rty) : T.ety = TODO: simplify? we only need the subst `T.RegionVarId.id -> T.RegionId.id` *) -let fresh_regions_with_substs (region_vars : T.region_var list) - (ctx : C.eval_ctx) : - C.eval_ctx - * T.RegionId.id list +let fresh_regions_with_substs (region_vars : T.region_var list) : + T.RegionId.id list * (T.RegionVarId.id -> T.RegionId.id) * (T.RegionVarId.id T.region -> T.RegionId.id T.region) = (* Generate fresh regions *) - let ctx, fresh_region_ids = - List.fold_left_map (fun ctx _ -> C.fresh_region_id ctx) ctx region_vars - in + let fresh_region_ids = List.map (fun _ -> C.fresh_region_id ()) region_vars in (* Generate the map from region var ids to regions *) let ls = List.combine region_vars fresh_region_ids in let rid_map = @@ -66,7 +62,7 @@ let fresh_regions_with_substs (region_vars : T.region_var list) match r with T.Static -> T.Static | T.Var id -> T.Var (rid_subst id) in (* Return *) - (ctx, fresh_region_ids, rid_subst, rsubst) + (fresh_region_ids, rid_subst, rsubst) (** Erase the regions in a type and substitute the type variables *) let erase_regions_substitute_types (tsubst : T.TypeVarId.id -> T.ety) |