summaryrefslogtreecommitdiff
path: root/src/InterpreterBorrowsCore.ml
diff options
context:
space:
mode:
authorSon Ho2022-01-13 20:38:51 +0100
committerSon Ho2022-01-13 20:38:51 +0100
commitd673cdc47a0b948871ac939075411be0929399c9 (patch)
tree5a4abdc04e8f5d11536f06cde065052ad16c225d /src/InterpreterBorrowsCore.ml
parent319e83218a2d859b9fb6bb431c5142278ceb1c78 (diff)
Start updating the assignment semantics
Diffstat (limited to 'src/InterpreterBorrowsCore.ml')
-rw-r--r--src/InterpreterBorrowsCore.ml14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/InterpreterBorrowsCore.ml b/src/InterpreterBorrowsCore.ml
index 3e402d88..e34a5383 100644
--- a/src/InterpreterBorrowsCore.ml
+++ b/src/InterpreterBorrowsCore.ml
@@ -532,14 +532,20 @@ let get_first_borrow_in_value (v : V.typed_value) : V.borrow_content option =
with FoundBorrowContent bc -> Some bc
(** Return the first loan or borrow content we find in a value (starting with
- the outer ones) *)
-let get_first_loan_or_borrow_in_value (v : V.typed_value) :
- loan_or_borrow_content option =
+ the outer ones).
+
+ [with_borrows]:
+ - if true: return the first loan or borrow we find
+ - if false: return the first loan we find, do not dive into borrowed values
+ *)
+let get_first_outer_loan_or_borrow_in_value (with_borrows : bool)
+ (v : V.typed_value) : loan_or_borrow_content option =
let obj =
object
inherit [_] V.iter_typed_value
- method! visit_borrow_content _ bc = raise (FoundBorrowContent bc)
+ method! visit_borrow_content _ bc =
+ if with_borrows then raise (FoundBorrowContent bc) else ()
method! visit_loan_content _ lc = raise (FoundLoanContent lc)
end