@@ -50,12 +50,6 @@ type error =
5050exception  Error  of Location. t *  Env. t *  error
5151exception  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 
6155let  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
16901656let  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
18681827let  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
0 commit comments