Skip to content

Commit

Permalink
Use local opens for option binding operator
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom committed Jan 4, 2024
1 parent 2102c40 commit 4460a4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ECMA-SL/semantics/domains/heap.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
open Syntax.Option

type 'a obj = 'a Object.t

type 'a t =
Expand All @@ -22,6 +20,7 @@ let set (heap : 'a t) (l : Loc.t) (obj : 'a obj) : unit =
Hashtbl.replace heap.map l obj

let rec get_opt (heap : 'a t) (l : Loc.t) : 'a obj option =
let open Syntax.Option in
match Hashtbl.find_opt heap.map l with
| Some _ as obj -> obj
| None ->
Expand All @@ -37,6 +36,7 @@ let get (heap : 'a t) (l : Loc.t) : ('a obj, string) Result.t =
| None -> Error (Format.sprintf "Cannot find lation '%s'." l)

let get_field_opt (heap : 'a t) (l : Loc.t) (fn : string) : 'a option =
let open Syntax.Option in
let* obj = get_opt heap l in
Object.get obj fn

Expand Down

0 comments on commit 4460a4e

Please sign in to comment.