summaryrefslogtreecommitdiff
path: root/compiler/ValuesUtils.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--compiler/ValuesUtils.ml18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/ValuesUtils.ml b/compiler/ValuesUtils.ml
index df00bfb2..470f40ac 100644
--- a/compiler/ValuesUtils.ml
+++ b/compiler/ValuesUtils.ml
@@ -170,6 +170,24 @@ let value_has_borrows (infos : TA.type_infos) (v : value) : bool =
false
with Found -> true
+(** Check if a value has loans.
+
+ Note that loans are necessarily concrete (there can't be loans hidden
+ inside symbolic values).
+ *)
+let value_has_loans (v : value) : bool =
+ let obj =
+ object
+ inherit [_] iter_typed_value
+ method! visit_loan_content _env _ = raise Found
+ end
+ in
+ (* We use exceptions *)
+ try
+ obj#visit_value () v;
+ false
+ with Found -> true
+
(** Check if a value has loans or borrows in **a general sense**.
It checks if: