@@ -82976,7 +82976,7 @@ module Js_number : sig
82976
82976
type t = float
82977
82977
82978
82978
82979
- val to_string : t -> string
82979
+ (* val to_string : t -> string *)
82980
82980
82981
82981
82982
82982
val caml_float_literal_to_js_string : string -> string
@@ -83057,18 +83057,20 @@ let to_string v =
83057
83057
else Printf.sprintf "%.18g" v
83058
83058
83059
83059
83060
+ let rec is_hex_format_aux (v : string) cur =
83061
+ if v.[cur] = '-' || v.[cur]= '+' then
83062
+ is_hex_format_ox v (cur + 1)
83063
+ else is_hex_format_ox v cur
83064
+ and is_hex_format_ox v cur =
83065
+ v.[cur] = '0' &&
83066
+ (v.[cur + 1] = 'x' || v.[cur + 1] = 'X')
83067
+
83068
+ let is_hex_format (v : string) =
83069
+ try is_hex_format_aux v 0 with _ -> false
83060
83070
83061
- let caml_float_literal_to_js_string v =
83071
+
83072
+ let caml_float_literal_to_js_string (v : string) : string =
83062
83073
let len = String.length v in
83063
- if len >= 2 &&
83064
- v.[0] = '0' &&
83065
- (v.[1] = 'x' || v.[1] = 'X') then
83066
- assert false
83067
- (* TODO: catchup when upgraded to 4.3
83068
- it does not make sense too much since js dos not
83069
- support it natively
83070
- *)
83071
- else
83072
83074
83073
83075
let rec aux buf i =
83074
83076
if i >= len then buf
@@ -83762,11 +83764,11 @@ and expression_desc cxt (level:int) f x : cxt =
83762
83764
| Number v ->
83763
83765
let s =
83764
83766
match v with
83765
- | Float {f = v } ->
83766
- Js_number.caml_float_literal_to_js_string v
83767
+ | Float {f} ->
83768
+ Js_number.caml_float_literal_to_js_string f
83767
83769
(* attach string here for float constant folding?*)
83768
- | Int { i = v ; _}
83769
- -> Int32.to_string v (* check , js convention with ocaml lexical convention *)
83770
+ | Int { i; _}
83771
+ -> Int32.to_string i (* check , js convention with ocaml lexical convention *)
83770
83772
| Uint i
83771
83773
-> Format.asprintf "%lu" i
83772
83774
| Nint i -> Nativeint.to_string i in
@@ -83776,7 +83778,8 @@ and expression_desc cxt (level:int) f x : cxt =
83776
83778
else level = 15 (* Parenthesize as well when followed by a dot. *)
83777
83779
&& s.[0] <> 'I' (* Infinity *)
83778
83780
&& s.[0] <> 'N' (* NaN *) in
83779
- let action = fun _ -> P.string f s in
83781
+ let action =
83782
+ fun _ -> P.string f s in
83780
83783
(
83781
83784
if need_paren
83782
83785
then P.paren f action
@@ -95390,7 +95393,7 @@ let translate loc (prim_name : string)
95390
95393
95391
95394
end
95392
95395
| "caml_format_float"
95393
-
95396
+
95394
95397
| "caml_nativeint_format"
95395
95398
| "caml_int32_format"
95396
95399
| "caml_float_of_string"
0 commit comments