@@ -71276,7 +71276,7 @@ let rec seq ?comment (e0 : t) (e1 : t) : t =
7127671276 | _, ( Seq(a,( {expression_desc = Number _ ; } as v ) ))->
7127771277 (* Return value could not be changed*)
7127871278 seq ?comment (seq e0 a) v
71279-
71279+ | (Number _ | Var _) , _ -> e1
7128071280 | _ ->
7128171281 {expression_desc = Seq(e0,e1); comment}
7128271282
@@ -71912,8 +71912,8 @@ let rec int_comp (cmp : Lambda.comparison) ?comment (e0 : t) (e1 : t) =
7191271912 bin ?comment (Lam_compile_util.jsop_of_comp cmp) e0 e1
7191371913
7191471914let bool_comp (cmp : Lambda.comparison) ?comment (e0 : t) (e1 : t) =
71915- match e0.expression_desc , e1.expression_desc with
71916- | Bool l, Bool r ->
71915+ match e0, e1 with
71916+ | {expression_desc = Bool l}, {expression_desc = Bool r} ->
7191771917 bool (match cmp with
7191871918 | Ceq -> l = r
7191971919 | Cneq -> l <> r
@@ -71922,19 +71922,22 @@ let bool_comp (cmp : Lambda.comparison) ?comment (e0 : t) (e1 : t) =
7192271922 | Cle -> l <= r
7192371923 | Cge -> l >= r
7192471924 )
71925- | Bool l, _ ->
71925+ | {expression_desc = Bool true}, rest
71926+ | rest, {expression_desc = Bool false} ->
7192671927 begin match cmp with
71927- | Clt -> seq e1 caml_false
71928- | Cge -> seq e1 caml_true
71928+ | Clt -> seq rest caml_false
71929+ | Cge -> seq rest caml_true
7192971930 | Cle
7193071931 | Cgt
7193171932 | Ceq
7193271933 | Cneq -> bin ?comment (Lam_compile_util.jsop_of_comp cmp) e0 e1
7193371934 end
71934- | _, Bool r ->
71935+ | rest, {expression_desc = Bool true}
71936+ | {expression_desc = Bool false}, rest
71937+ ->
7193571938 begin match cmp with
71936- | Cle -> seq e0 caml_true
71937- | Cgt -> seq e0 caml_false
71939+ | Cle -> seq rest caml_true
71940+ | Cgt -> seq rest caml_false
7193871941 | Clt
7193971942 | Cge
7194071943 | Ceq
@@ -94941,6 +94944,14 @@ let translate loc (prim_name : string)
9494194944 E.string_comp Ge e0 e1
9494294945 | _ -> assert false
9494394946 end
94947+ | "caml_string_greaterthan"
94948+ ->
94949+ begin match args with
94950+ | [e0; e1]
94951+ ->
94952+ E.string_comp Gt e0 e1
94953+ | _ -> assert false
94954+ end
9494494955 | "caml_bool_notequal"
9494594956 ->
9494694957 begin match args with
@@ -94973,7 +94984,13 @@ let translate loc (prim_name : string)
9497394984 E.bool_comp Cge e0 e1
9497494985 | _ -> assert false
9497594986 end
94976-
94987+ | "caml_bool_greaterthan"
94988+ ->
94989+ begin match args with
94990+ | [e0;e1] ->
94991+ E.bool_comp Cgt e0 e1
94992+ | _ -> assert false
94993+ end
9497794994 | "caml_bool_equal"
9497894995 | "caml_bool_equal_null"
9497994996 | "caml_bool_equal_nullable"
@@ -95022,14 +95039,7 @@ let translate loc (prim_name : string)
9502295039 | _ -> assert false
9502395040 end
9502495041
95025- | "caml_string_greaterthan"
95026- ->
95027- begin match args with
95028- | [e0; e1]
95029- ->
95030- E.string_comp Gt e0 e1
95031- | _ -> assert false
95032- end
95042+
9503395043 | "caml_create_string" ->
9503495044 (* Bytes.create *)
9503595045 (* Note that for invalid range, JS raise an Exception RangeError,
0 commit comments