summaryrefslogtreecommitdiff
path: root/compiler/ValuesUtils.ml
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/ValuesUtils.ml')
-rw-r--r--compiler/ValuesUtils.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/ValuesUtils.ml b/compiler/ValuesUtils.ml
index 470f40ac..adeb105f 100644
--- a/compiler/ValuesUtils.ml
+++ b/compiler/ValuesUtils.ml
@@ -37,6 +37,13 @@ let as_mut_borrow (v : typed_value) : BorrowId.id * typed_value =
| Borrow (MutBorrow (bid, bv)) -> (bid, bv)
| _ -> raise (Failure "Unexpected")
+let is_unit (v : typed_value) : bool =
+ ty_is_unit v.ty
+ &&
+ match v.value with
+ | Adt av -> av.variant_id = None && av.field_values = []
+ | _ -> false
+
(** Check if a value contains a *concrete* borrow (i.e., a [Borrow] value -
we don't check if there are borrows hidden in symbolic values).
*)