@@ -166,13 +166,9 @@ let raw_js_code ?comment info s : t =
166
166
}
167
167
168
168
let array ?comment mt es : t = {expression_desc = Array (es, mt); comment}
169
- let some_comment = None
169
+ let optional_block e : J.expression = e
170
170
171
- let optional_block e : J.expression =
172
- {expression_desc = Optional_block (e, false ); comment = some_comment}
173
-
174
- let optional_not_nest_block e : J.expression =
175
- {expression_desc = Optional_block (e, true ); comment = None }
171
+ let optional_not_nest_block e : J.expression = e
176
172
177
173
(* * used in normal property
178
174
like [e.length], no dependency introduced
@@ -599,7 +595,7 @@ let str_equal (txt0 : string) (delim0 : External_arg_spec.delim) txt1 delim1 =
599
595
else None
600
596
else None
601
597
602
- let rec triple_equal ?comment (e0 : t ) (e1 : t ) : t =
598
+ let triple_equal ?comment (e0 : t ) (e1 : t ) : t =
603
599
match (e0.expression_desc, e1.expression_desc) with
604
600
| ( (Null | Undefined _),
605
601
(Bool _ | Number _ | Typeof _ | Fun _ | Array _ | Caml_block _) )
@@ -610,11 +606,7 @@ let rec triple_equal ?comment (e0 : t) (e1 : t) : t =
610
606
when no_side_effect e0 ->
611
607
false_
612
608
| Number (Int {i = i0 ; _} ), Number (Int {i = i1 ; _} ) -> bool (i0 = i1)
613
- | Optional_block (a , _ ), Optional_block (b , _ ) -> triple_equal ?comment a b
614
- | Undefined _, Optional_block _
615
- | Optional_block _, Undefined _
616
- | Null , Undefined _
617
- | Undefined _, Null
609
+ | (Null , Undefined _ | Undefined _, Null )
618
610
when no_side_effect e0 && no_side_effect e1 ->
619
611
false_
620
612
| Null , Null | Undefined _ , Undefined _ -> true_
@@ -1388,14 +1380,8 @@ let rec int_comp (cmp : Lam_compat.comparison) ?comment (e0 : t) (e1 : t) =
1388
1380
_ ),
1389
1381
Number (Int {i = 0l }) ) ->
1390
1382
int_comp cmp l r (* = 0 > 0 < 0 *)
1391
- | (Ceq , Optional_block _, Undefined _ | Ceq , Undefined _, Optional_block _)
1392
- when no_side_effect e0 && no_side_effect e1 ->
1393
- false_
1394
1383
| Ceq , _ , _ -> int_equal e0 e1
1395
- | Cneq , Optional_block _, Undefined _
1396
- | Cneq , Undefined _, Optional_block _
1397
- | Cneq , Caml_block _, Number _
1398
- | Cneq , Number _, Caml_block _
1384
+ | (Cneq , Caml_block _, Number _ | Cneq , Number _, Caml_block _)
1399
1385
when no_side_effect e0 && no_side_effect e1 ->
1400
1386
true_
1401
1387
| _ -> bin ?comment (Lam_compile_util. jsop_of_comp cmp) e0 e1
0 commit comments