Skip to content

Commit cf177c6

Browse files
committed
Remove bytes_of_string.
1 parent 7947d59 commit cf177c6

16 files changed

+80
-164
lines changed

jscomp/core/js_of_lam_string.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,3 @@ let set_byte e e0 e1 = E.assign (E.array_index e e0) e1
6161
*)
6262
let bytes_to_string e =
6363
E.runtime_call Js_runtime_modules.bytes_ "bytes_to_string" [ e ]
64-
65-
let bytes_of_string s =
66-
E.runtime_call Js_runtime_modules.bytes "bytes_of_string" [ s ]

jscomp/core/js_of_lam_string.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,3 @@ val set_byte : J.expression -> J.expression -> J.expression -> J.expression
3737
val const_char : char -> J.expression
3838

3939
val bytes_to_string : J.expression -> J.expression
40-
41-
val bytes_of_string : J.expression -> J.expression

jscomp/core/lam_analysis.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ let rec no_side_effects (lam : Lam.t) : bool =
6262
| Pundefined_to_opt | Pnull_undefined_to_opt | Pjs_fn_make _
6363
| Pjs_object_create _
6464
(* TODO: check *)
65-
| Pbytes_to_string | Pbytes_of_string | Pmakeblock _
65+
| Pbytes_to_string | Pmakeblock _
6666
(* whether it's mutable or not *)
6767
| Pfield _ | Pval_from_option | Pval_from_option_not_nest
6868
(* NOP The compiler already [t option] is the same as t *)

jscomp/core/lam_compile_primitive.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,6 @@ let translate loc (cxt : Lam_compile_context.t) (prim : Lam_primitive.t)
219219
*)
220220
| [ range; e ] -> E.is_out (E.offset e off) range
221221
| _ -> assert false)
222-
| Pbytes_of_string ->
223-
(* TODO: write a js primitive - or is it necessary ?
224-
if we have byte_get/string_get
225-
still necessary, since you can set it now.
226-
*)
227-
Js_of_lam_string.bytes_of_string (Ext_list.singleton_exn args)
228222
| Pbytes_to_string ->
229223
Js_of_lam_string.bytes_to_string (Ext_list.singleton_exn args)
230224
| Pstringlength -> E.string_length (Ext_list.singleton_exn args)

jscomp/core/lam_convert.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
167167
| Ploc _ -> assert false (* already compiled away here*)
168168
| Pbytes_to_string (* handled very early *) ->
169169
prim ~primitive:Pbytes_to_string ~args loc
170-
| Pbytes_of_string -> prim ~primitive:Pbytes_of_string ~args loc
171170
| Pcreate_extension s -> prim ~primitive:(Pcreate_extension s) ~args loc
172171
| Pignore ->
173172
(* Pignore means return unit, it is not an nop *)

jscomp/core/lam_primitive.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ type record_representation =
3434

3535
type t =
3636
| Pbytes_to_string
37-
| Pbytes_of_string
3837
(* Operations on heap blocks *)
3938
| Pmakeblock of int * Lam_tag_info.t * Asttypes.mutable_flag
4039
| Pfield of int * Lam_compat.field_dbg_info
@@ -172,7 +171,6 @@ let eq_primitive_approx (lhs : t) (rhs : t) =
172171
match rhs with Pcreate_extension b -> a = (b : string) | _ -> false)
173172
| Pwrap_exn -> rhs = Pwrap_exn
174173
| Pbytes_to_string -> rhs = Pbytes_to_string
175-
| Pbytes_of_string -> rhs = Pbytes_of_string
176174
| Praise -> rhs = Praise
177175
| Psequand -> rhs = Psequand
178176
| Psequor -> rhs = Psequor

jscomp/core/lam_primitive.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ type record_representation =
3232

3333
type t =
3434
| Pbytes_to_string
35-
| Pbytes_of_string
3635
| Pmakeblock of int * Lam_tag_info.t * Asttypes.mutable_flag
3736
| Pfield of int * Lambda.field_dbg_info
3837
| Psetfield of int * Lambda.set_field_dbg_info

jscomp/core/lam_print.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ let primitive ppf (prim : Lam_primitive.t) =
5656
| Pinit_mod -> fprintf ppf "init_mod!"
5757
| Pupdate_mod -> fprintf ppf "update_mod!"
5858
| Pbytes_to_string -> fprintf ppf "bytes_to_string"
59-
| Pbytes_of_string -> fprintf ppf "bytes_of_string"
6059
| Pjs_apply -> fprintf ppf "#apply"
6160
| Pjs_runtime_apply -> fprintf ppf "#runtime_apply"
6261
| Pjs_unsafe_downgrade { name; setter } ->

jscomp/main/builtin_cmj_datasets.ml

Lines changed: 19 additions & 19 deletions
Large diffs are not rendered by default.

jscomp/ml/lambda.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ type is_safe =
146146
type primitive =
147147
| Pidentity
148148
| Pbytes_to_string
149-
| Pbytes_of_string
150149
| Pignore
151150
| Prevapply
152151
| Pdirapply

0 commit comments

Comments
 (0)