@@ -35,7 +35,7 @@ type t = J.expression
3535 *)
3636let rec remove_pure_sub_exp (x : t ) : t option =
3737 match x.expression_desc with
38- | Var _ | Str _ | Unicode _ | Number _ -> None (* Can be refined later *)
38+ | Var _ | Str _ | Number _ -> None (* Can be refined later *)
3939 | Array_index (a , b ) ->
4040 if is_pure_sub_exp a && is_pure_sub_exp b then None else Some x
4141 | Array (xs , _mutable_flag ) ->
@@ -128,8 +128,6 @@ let runtime_ref module_name fn_name = runtime_var_dot module_name fn_name
128128let str ?(delim = None ) ?comment txt : t =
129129 { expression_desc = Str {txt; delim}; comment }
130130
131- let unicode ?comment s : t = { expression_desc = Unicode s; comment }
132-
133131let raw_js_code ?comment info s : t =
134132 {
135133 expression_desc = Raw_js_code { code = String. trim s; code_info = info };
@@ -173,7 +171,7 @@ module L = Literals
173171let typeof ?comment (e : t ) : t =
174172 match e.expression_desc with
175173 | Number _ | Length _ -> str ?comment L. js_type_number
176- | Str _ | Unicode _ -> str ?comment L. js_type_string
174+ | Str _ -> str ?comment L. js_type_string
177175 | Array _ -> str ?comment L. js_type_object
178176 | Bool _ -> str ?comment L. js_type_boolean
179177 | _ -> { expression_desc = Typeof e; comment }
@@ -477,7 +475,7 @@ let array_length ?comment (e : t) : t =
477475
478476let string_length ?comment (e : t ) : t =
479477 match e.expression_desc with
480- | Str {txt} -> int ?comment (Int32. of_int (String. length txt))
478+ | Str {txt; delim = None } -> int ?comment (Int32. of_int (String. length txt))
481479 (* No optimization for {j||j}*)
482480 | _ -> { expression_desc = Length (e, String ); comment }
483481
@@ -551,8 +549,6 @@ let rec triple_equal ?comment (e0 : t) (e1 : t) : t =
551549 | Str {txt =x } , Str {txt =y } ->
552550 (* CF*)
553551 bool (Ext_string. equal x y)
554- | Unicode x , Unicode y ->
555- bool (Ext_string. equal x y)
556552 | Number (Int { i = i0 ; _ } ), Number (Int { i = i1 ; _ } ) -> bool (i0 = i1)
557553 | Optional_block (a , _ ), Optional_block (b , _ ) -> triple_equal ?comment a b
558554 | Undefined , Optional_block _
@@ -609,7 +605,7 @@ let and_ ?comment (e1 : t) (e2 : t) : t =
609605 Bin
610606 ( EqEqEq ,
611607 { expression_desc = Var j },
612- { expression_desc = Str _ | Number _ | Unicode _ } ) )
608+ { expression_desc = Str _ | Number _ } ) )
613609 when Js_op_util. same_vident i j ->
614610 e2
615611 | _ , _ -> { expression_desc = Bin (And , e1, e2); comment }
@@ -729,7 +725,6 @@ let int_equal = float_equal
729725let string_equal ?comment (e0 : t ) (e1 : t ) : t =
730726 match (e0.expression_desc, e1.expression_desc) with
731727 | Str {txt =a0 } , Str {txt =b0 } -> bool (Ext_string. equal a0 b0)
732- | Unicode a0 , Unicode b0 -> bool (Ext_string. equal a0 b0)
733728 | _ , _ -> { expression_desc = Bin (EqEqEq , e0, e1); comment }
734729
735730let is_type_number ?comment (e : t ) : t =
@@ -812,8 +807,7 @@ let uint32 ?comment n : J.expression =
812807
813808let string_comp (cmp : J.binop ) ?comment (e0 : t ) (e1 : t ) =
814809 match (e0.expression_desc, e1.expression_desc) with
815- | Str {txt= a0}, Str {txt= b0}
816- | Unicode a0 , Unicode b0 -> (
810+ | Str {txt =a0 } , Str {txt =b0 } -> (
817811 match cmp with
818812 | EqEqEq -> bool (a0 = b0)
819813 | NotEqEq -> bool (a0 <> b0)
0 commit comments