diff options
author | Son Ho | 2022-12-12 13:25:37 +0100 |
---|---|---|
committer | Son HO | 2023-02-03 11:21:46 +0100 |
commit | a5d09658b0c15862b609226d18f072c5d9f1e953 (patch) | |
tree | d345e4bb101e320816479837492a0693efd1689e /compiler/ValuesUtils.ml | |
parent | e6edaac99fc38fc3cb574db06fe83c7eb32ef37b (diff) |
Make progress on Interpreter.ml
Diffstat (limited to '')
-rw-r--r-- | compiler/ValuesUtils.ml | 7 |
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). *) |