summaryrefslogtreecommitdiff
path: root/compiler/ValuesUtils.ml
diff options
context:
space:
mode:
authorSon Ho2022-12-12 13:25:37 +0100
committerSon HO2023-02-03 11:21:46 +0100
commita5d09658b0c15862b609226d18f072c5d9f1e953 (patch)
treed345e4bb101e320816479837492a0693efd1689e /compiler/ValuesUtils.ml
parente6edaac99fc38fc3cb574db06fe83c7eb32ef37b (diff)
Make progress on Interpreter.ml
Diffstat (limited to '')
-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).
*)