Skip to content

Commit 961c468

Browse files
committed
remove unused code
1 parent c37d2f5 commit 961c468

File tree

2 files changed

+2
-123
lines changed

2 files changed

+2
-123
lines changed

typing/typemod.ml

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ type error =
5050
exception Error of Location.t * Env.t * error
5151
exception Error_forward of Location.error
5252

53-
module ImplementationHooks = Misc.MakeHooks(struct
54-
type t = Typedtree.structure * Typedtree.module_coercion
55-
end)
56-
module InterfaceHooks = Misc.MakeHooks(struct
57-
type t = Typedtree.signature
58-
end)
5953

6054
#if true
6155
let should_hide : (Typedtree.module_binding -> bool) ref = ref (fun _ -> false)
@@ -1571,33 +1565,8 @@ and type_structure ?(toplevel = false) funct_body anchor env sstr scope =
15711565
| Pstr_open sod ->
15721566
let (_path, newenv, od) = type_open ~toplevel env sod in
15731567
Tstr_open od, [], newenv
1574-
| Pstr_class cl ->
1575-
List.iter
1576-
(fun {pci_name} -> check_name check_type names pci_name)
1577-
cl;
1578-
let (classes, new_env) = Typeclass.class_declarations env cl in
1579-
Tstr_class
1580-
(List.map (fun cls ->
1581-
(cls.Typeclass.cls_info,
1582-
cls.Typeclass.cls_pub_methods)) classes),
1583-
(* TODO: check with Jacques why this is here
1584-
Tstr_class_type
1585-
(List.map (fun (_,_, i, d, _,_,_,_,_,_,c) -> (i, c)) classes) ::
1586-
Tstr_type
1587-
(List.map (fun (_,_,_,_, i, d, _,_,_,_,_) -> (i, d)) classes) ::
1588-
Tstr_type
1589-
(List.map (fun (_,_,_,_,_,_, i, d, _,_,_) -> (i, d)) classes) ::
1590-
*)
1591-
List.flatten
1592-
(map_rec
1593-
(fun rs cls ->
1594-
let open Typeclass in
1595-
[Sig_class(cls.cls_id, cls.cls_decl, rs);
1596-
Sig_class_type(cls.cls_ty_id, cls.cls_ty_decl, rs);
1597-
Sig_type(cls.cls_obj_id, cls.cls_obj_abbr, rs);
1598-
Sig_type(cls.cls_typesharp_id, cls.cls_abbr, rs)])
1599-
classes []),
1600-
new_env
1568+
| Pstr_class () ->
1569+
assert false
16011570
| Pstr_class_type cl ->
16021571
List.iter
16031572
(fun {pci_name} -> check_name check_type names pci_name)
@@ -1682,9 +1651,6 @@ let type_toplevel_phrase env s =
16821651
Env.reset_required_globals ();
16831652
let (str, sg, env) =
16841653
type_structure ~toplevel:true false None env s Location.none in
1685-
let (str, _coerce) = ImplementationHooks.apply_hooks
1686-
{ Misc.sourcefile = "//toplevel//" } (str, Tcoerce_none)
1687-
in
16881654
(str, sg, env)
16891655

16901656
let type_module_alias = type_module ~alias:true true false None
@@ -1802,12 +1768,8 @@ let type_implementation_more ?check_exists sourcefile outputprefix modulename in
18021768
end else begin
18031769
let sourceintf =
18041770
Filename.remove_extension sourcefile ^ !Config.interface_suffix in
1805-
#if undefined BS_NO_COMPILER_PATCH then
18061771
let mli_status = !Clflags.assume_no_mli in
18071772
if (mli_status = Clflags.Mli_na && Sys.file_exists sourceintf) || (mli_status = Clflags.Mli_exists) then begin
1808-
#else
1809-
if Sys.file_exists sourceintf then begin
1810-
#end
18111773
let intf_file =
18121774
try
18131775
find_in_path_uncap !Config.load_path (modulename ^ ".cmi")
@@ -1861,86 +1823,15 @@ let type_implementation sourcefile outputprefix modulename initial_env ast =
18611823
type_implementation_more sourcefile outputprefix modulename initial_env ast in
18621824
a,b
18631825

1864-
let type_implementation sourcefile outputprefix modulename initial_env ast =
1865-
ImplementationHooks.apply_hooks { Misc.sourcefile }
1866-
(type_implementation sourcefile outputprefix modulename initial_env ast)
18671826

18681827
let save_signature modname tsg outputprefix source_file initial_env cmi =
18691828
Cmt_format.save_cmt (outputprefix ^ ".cmti") modname
18701829
(Cmt_format.Interface tsg) (Some source_file) initial_env (Some cmi)
18711830

1872-
let type_interface sourcefile env ast =
1873-
InterfaceHooks.apply_hooks { Misc.sourcefile } (transl_signature env ast)
18741831

18751832
(* "Packaging" of several compilation units into one unit
18761833
having them as sub-modules. *)
18771834

1878-
let rec package_signatures subst = function
1879-
[] -> []
1880-
| (name, sg) :: rem ->
1881-
let sg' = Subst.signature subst sg in
1882-
let oldid = Ident.create_persistent name
1883-
and newid = Ident.create name in
1884-
Sig_module(newid, {md_type=Mty_signature sg';
1885-
md_attributes=[];
1886-
md_loc=Location.none;
1887-
},
1888-
Trec_not) ::
1889-
package_signatures (Subst.add_module oldid (Pident newid) subst) rem
1890-
1891-
let package_units initial_env objfiles cmifile modulename =
1892-
(* Read the signatures of the units *)
1893-
let units =
1894-
List.map
1895-
(fun f ->
1896-
let pref = chop_extensions f in
1897-
let modname = String.capitalize_ascii(Filename.basename pref) in
1898-
let sg = Env.read_signature modname (pref ^ ".cmi") in
1899-
if Filename.check_suffix f ".cmi" &&
1900-
not(Mtype.no_code_needed_sig (Lazy.force Env.initial_safe_string) sg)
1901-
then raise(Error(Location.none, Env.empty,
1902-
Implementation_is_required f));
1903-
(modname, Env.read_signature modname (pref ^ ".cmi")))
1904-
objfiles in
1905-
(* Compute signature of packaged unit *)
1906-
Ident.reinit();
1907-
let sg = package_signatures Subst.identity units in
1908-
(* See if explicit interface is provided *)
1909-
let prefix = Filename.remove_extension cmifile in
1910-
let mlifile = prefix ^ !Config.interface_suffix in
1911-
#if undefined BS_NO_COMPILER_PATCH then
1912-
let mli_status = !Clflags.assume_no_mli in
1913-
if (mli_status = Clflags.Mli_na && Sys.file_exists mlifile) || (mli_status = Clflags.Mli_exists) then begin
1914-
#else
1915-
if Sys.file_exists mlifile then begin
1916-
#end
1917-
if not (Sys.file_exists cmifile) then begin
1918-
raise(Error(Location.in_file mlifile, Env.empty,
1919-
Interface_not_compiled mlifile))
1920-
end;
1921-
let dclsig = Env.read_signature modulename cmifile in
1922-
Cmt_format.save_cmt (prefix ^ ".cmt") modulename
1923-
(Cmt_format.Packed (sg, objfiles)) None initial_env None ;
1924-
Includemod.compunit initial_env "(obtained by packing)" sg mlifile dclsig
1925-
end else begin
1926-
(* Determine imports *)
1927-
let unit_names = List.map fst units in
1928-
let imports =
1929-
List.filter
1930-
(fun (name, _crc) -> not (List.mem name unit_names))
1931-
(Env.imports()) in
1932-
(* Write packaged signature *)
1933-
if not !Clflags.dont_write_files then begin
1934-
let cmi =
1935-
Env.save_signature_with_imports ~deprecated:None
1936-
sg modulename
1937-
(prefix ^ ".cmi") imports
1938-
in
1939-
Cmt_format.save_cmt (prefix ^ ".cmt") modulename
1940-
(Cmt_format.Packed (cmi.Cmi_format.cmi_sign, objfiles)) None initial_env (Some cmi)
1941-
end;
1942-
Tcoerce_none
1943-
end
19441835

19451836
(* Error report *)
19461837

typing/typemod.mli

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,13 @@ val type_implementation:
3737
string -> string -> string -> Env.t -> Parsetree.structure ->
3838
Typedtree.structure * Typedtree.module_coercion
3939

40-
val type_interface:
41-
string -> Env.t -> Parsetree.signature -> Typedtree.signature
4240
val transl_signature:
4341
Env.t -> Parsetree.signature -> Typedtree.signature
4442
val check_nongen_schemes:
4543
Env.t -> Types.signature -> unit
4644
val type_open_:
4745
?used_slot:bool ref -> ?toplevel:bool -> Asttypes.override_flag ->
4846
Env.t -> Location.t -> Longident.t Asttypes.loc -> Path.t * Env.t
49-
val modtype_of_package:
50-
Env.t -> Location.t ->
51-
Path.t -> Longident.t list -> type_expr list -> module_type
5247
val simplify_signature: signature -> signature
5348

5449
val path_of_module : Typedtree.module_expr -> Path.t option
@@ -57,9 +52,6 @@ val save_signature:
5752
string -> Typedtree.signature -> string -> string ->
5853
Env.t -> Cmi_format.cmi_infos -> unit
5954

60-
val package_units:
61-
Env.t -> string list -> string -> string -> Typedtree.module_coercion
62-
6355
type error =
6456
Cannot_apply of module_type
6557
| Not_included of Includemod.error list
@@ -96,7 +88,3 @@ val super_report_error_no_wrap_printing_env: formatter -> error -> unit
9688
val report_error: Env.t -> formatter -> error -> unit
9789

9890

99-
module ImplementationHooks : Misc.HookSig
100-
with type t = Typedtree.structure * Typedtree.module_coercion
101-
module InterfaceHooks : Misc.HookSig
102-
with type t = Typedtree.signature

0 commit comments

Comments
 (0)