diff options
Diffstat (limited to '')
-rw-r--r-- | src/PureUtils.ml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/PureUtils.ml b/src/PureUtils.ml index 140f4082..9596cd9b 100644 --- a/src/PureUtils.ml +++ b/src/PureUtils.ml @@ -58,6 +58,18 @@ let mk_result_return_rvalue (v : typed_rvalue) : typed_rvalue = in { value; ty } +let mk_result_fail_lvalue (ty : ty) : typed_lvalue = + let ty = Adt (Assumed Result, [ ty ]) in + let value = LvAdt { variant_id = Some result_fail_id; field_values = [] } in + { value; ty } + +let mk_result_return_lvalue (v : typed_lvalue) : typed_lvalue = + let ty = Adt (Assumed Result, [ v.ty ]) in + let value = + LvAdt { variant_id = Some result_return_id; field_values = [ v ] } + in + { value; ty } + let mk_result_ty (ty : ty) : ty = Adt (Assumed Result, [ ty ]) (** Type substitution *) |