@@ -101,7 +101,7 @@ module Types = struct
101101 | Lstringswitch of t * (string * t) list * t option
102102 | Lstaticraise of int * t list
103103 | Lstaticcatch of t * (int * ident list ) * t
104- | Ltrywith of t * ident * t
104+ | Ltrywith of t * ident * t option * t option
105105 | Lifthenelse of t * t * t
106106 | Lsequence of t * t
107107 | Lwhile of t * t
@@ -153,7 +153,7 @@ module X = struct
153153 | Lstringswitch of t * (string * t) list * t option
154154 | Lstaticraise of int * t list
155155 | Lstaticcatch of t * (int * ident list ) * t
156- | Ltrywith of t * ident * t
156+ | Ltrywith of t * ident * t option * t option
157157 | Lifthenelse of t * t * t
158158 | Lsequence of t * t
159159 | Lwhile of t * t
@@ -224,10 +224,11 @@ let inner_map (l : t) (f : t -> X.t) : X.t =
224224 let e1 = f e1 in
225225 let e2 = f e2 in
226226 Lstaticcatch (e1, vars, e2)
227- | Ltrywith (e1 , exn , e2 ) ->
227+ | Ltrywith (e1 , exn , e2 , finally_expr ) ->
228228 let e1 = f e1 in
229- let e2 = f e2 in
230- Ltrywith (e1, exn , e2)
229+ let e2 = Ext_option. map e2 f in
230+ let finally_expr = Ext_option. map finally_expr f in
231+ Ltrywith (e1, exn , e2, finally_expr)
231232 | Lifthenelse (e1 , e2 , e3 ) ->
232233 let e1 = f e1 in
233234 let e2 = f e2 in
@@ -457,7 +458,8 @@ let function_ ~attr ~arity ~params ~body : t =
457458let let_ kind id e body : t = Llet (kind, id, e, body)
458459let letrec bindings body : t = Lletrec (bindings, body)
459460let while_ a b : t = Lwhile (a, b)
460- let try_ body id handler : t = Ltrywith (body, id, handler)
461+ let try_ body id handler finally_expr : t =
462+ Ltrywith (body, id, handler, finally_expr)
461463let for_ v e1 e2 dir e3 : t = Lfor (v, e1, e2, dir, e3)
462464let assign v l : t = Lassign (v, l)
463465let staticcatch a b c : t = Lstaticcatch (a, b, c)
0 commit comments