Skip to content

Commit e705cf7

Browse files
committed
remove unused code
1 parent 0b40a32 commit e705cf7

File tree

4 files changed

+7
-47
lines changed

4 files changed

+7
-47
lines changed

jscomp/core/js_stmt_make.ml

+1-18
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ type t = J.statement
3434
let return_stmt ?comment e : t =
3535
{statement_desc = Return {return_value = e; } ; comment}
3636

37-
(* let return_unit : t list =
38-
[{ statement_desc = Return {return_value = E.unit; } ;
39-
comment = None}] *)
4037

4138
let empty_stmt : t =
4239
{ statement_desc = Block []; comment = None}
@@ -301,21 +298,7 @@ let assign ?comment id e : t =
301298
statement_desc = J.Exp ( E.assign (E.var id) e ) ;
302299
comment
303300
}
304-
(* let assign_unit ?comment id : t =
305-
{
306-
statement_desc = J.Exp( E.assign (E.var id) E.unit);
307-
comment
308-
}
309-
let declare_unit ?comment id : t =
310-
{
311-
statement_desc =
312-
J.Variable { ident = id;
313-
value = Some E.unit;
314-
property = Variable;
315-
ident_info = {used_stats = NA}
316-
};
317-
comment
318-
} *)
301+
319302

320303
let while_ ?comment ?label ?env (e : E.t) (st : J.block) : t =
321304
let env =

jscomp/core/lam_dispatch_primitive.ml

-28
Original file line numberDiff line numberDiff line change
@@ -563,35 +563,7 @@ let translate loc (prim_name : string)
563563
| "caml_blit_bytes"
564564
->
565565
call Js_runtime_modules.bytes
566-
567-
| "caml_register_named_value" ->
568-
(**
569-
callback.ml
570-
{[ external register_named_value : string -> Obj.t -> unit
571-
= "caml_register_named_value" ]}
572-
573-
See the manual chap19, Interfacing C with OCaml
574-
575-
{[
576-
let f x = print_string "f is applied to "; print_int x; print_newline()
577-
let _ = Callback.register "test function" f
578-
]}
579-
580-
On the C side
581-
{[
582-
let f x = print_string "f is applied to "; print_int x; print_newline()
583-
let _ = Callback.register "test function" f
584-
]}
585-
586-
[caml_named_value] is a c primitive but not belong to OCaml/runtimedef.ml,
587-
so we don't needs
588-
handle it
589-
*)
590-
E.unit
591-
592566
| "caml_backtrace_status"
593-
594-
595567
| "caml_get_exception_backtrace"
596568
| "caml_get_exception_raw_backtrace"
597569
| "caml_record_backtrace"

jscomp/stdlib-406/callback.ml

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
[@@@bs.config { flags = [|"-bs-no-cross-module-opt" |]}]
1616
(* Registering OCaml values with the C runtime for later callbacks *)
1717

18+
#if BS then
19+
let register _ _ = ()
20+
let register_exception _ _ = ()
21+
#else
1822
external register_named_value : string -> Obj.t -> unit
1923
= "caml_register_named_value"
2024

@@ -25,3 +29,4 @@ let register_exception name (exn : exn) =
2529
let exn = Obj.repr exn in
2630
let slot = if Obj.tag exn = Obj.object_tag then exn else Obj.field exn 0 in
2731
register_named_value name slot
32+
#end

jscomp/stdlib-406/printexc.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
(* special exception on linking described in the file LICENSE. *)
1313
(* *)
1414
(**************************************************************************)
15-
15+
[@@@bs.config { flags = [|"-bs-no-cross-module-opt" |]}]
1616
open Printf
1717

1818
let printers = ref []

0 commit comments

Comments
 (0)