1515
1616(* Translation from typed abstract syntax to lambda terms,
1717 for the module language *)
18-
18+ #if BS_ONLY then
19+ module Translobj = struct
20+ let oo_wrap _env _b f a = f a
21+ let reset_labels () : unit = ()
22+ let transl_store_label_init _ _ _ _ : int * _ = assert false
23+ let transl_label_init _ : _ * 'a = assert false
24+ end
25+ #end
1926open Misc
2027open Asttypes
2128open Longident
@@ -25,7 +32,7 @@ open Typedtree
2532open Lambda
2633open Translobj
2734open Translcore
28- open Translclass
35+
2936
3037type error =
3138 Circular_dependency of Ident .t
@@ -364,15 +371,15 @@ let rec bound_value_identifiers = function
364371
365372
366373(* Code to translate class entries in a structure *)
367-
374+ #if undefined BS_ONLY then
368375let transl_class_bindings cl_list =
369376 let ids = List. map (fun (ci , _ ) -> ci.ci_id_class) cl_list in
370377 (ids,
371378 List. map
372379 (fun ({ci_id_class =id ; ci_expr =cl ; ci_virt =vf } , meths ) ->
373- (id, transl_class ids id meths cl vf))
380+ (id, Translclass. transl_class ids id meths cl vf))
374381 cl_list)
375-
382+ #end
376383(* Compile one or more functors, merging curried functors to produce
377384 multi-argument functors. Any [@inline] attribute on a functor that is
378385 merged must be consistent with any other [@inline] attribute(s) on the
@@ -632,13 +639,17 @@ and transl_structure loc fields cc rootpath final_env = function
632639 body
633640 in
634641 lam, size
642+ #if undefined BS_ONLY then
635643 | Tstr_class cl_list ->
636644 let (ids, class_bindings) = transl_class_bindings cl_list in
637645 let body, size =
638646 transl_structure loc (List. rev_append ids fields)
639647 cc rootpath final_env rem
640648 in
641649 Lletrec (class_bindings, body), size
650+ #else
651+ | Tstr_class _ -> assert false
652+ #end
642653 | Tstr_include incl ->
643654 let ids = bound_value_identifiers incl.incl_type in
644655 let modl = incl.incl_mod in
@@ -972,14 +983,17 @@ let transl_store_structure glob map prims str =
972983 bindings
973984 (Lsequence (store_idents Location. none ids,
974985 transl_store rootpath (add_idents true ids subst) rem))
986+ #if BS_ONLY then
987+ | Tstr_class _ -> assert false
988+ #else
975989 | Tstr_class cl_list ->
976990 let (ids, class_bindings) = transl_class_bindings cl_list in
977991 let lam =
978992 Lletrec (class_bindings, store_idents Location. none ids)
979993 in
980994 Lsequence (subst_lambda subst lam,
981995 transl_store rootpath (add_idents false ids subst) rem)
982-
996+ #end
983997 | Tstr_include {
984998 incl_loc= loc;
985999 incl_mod= {
@@ -1235,12 +1249,16 @@ let transl_toplevel_item item =
12351249 (fun id modl _loc -> transl_module Tcoerce_none (Some (Pident id)) modl)
12361250 bindings
12371251 (make_sequence toploop_setvalue_id idents)
1252+ #if BS_ONLY then
1253+ | Tstr_class _ -> assert false
1254+ #else
12381255 | Tstr_class cl_list ->
12391256 (* we need to use unique names for the classes because there might
12401257 be a value named identically *)
12411258 let (ids, class_bindings) = transl_class_bindings cl_list in
12421259 List. iter set_toplevel_unique_name ids;
12431260 Lletrec (class_bindings, make_sequence toploop_setvalue_id ids)
1261+ #end
12441262 | Tstr_include incl ->
12451263 let ids = bound_value_identifiers incl.incl_type in
12461264 let modl = incl.incl_mod in
0 commit comments