Commit 5ec1efb8 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-06-25 13:34:21 by afrisch] Does not hide Not_found raised by find_node

Original author: afrisch
Date: 2004-06-25 13:34:21+00:00
parent 4a5eb6fc
...@@ -281,21 +281,8 @@ ifdef ML_INTERFACE then ...@@ -281,21 +281,8 @@ ifdef ML_INTERFACE then
let check_ml cu id out_dir out = let check_ml cu id out_dir out =
let fnam = String.copy cu in let fnam = String.copy cu in
String.set fnam 0 ( Char.lowercase ( String.get fnam 0 ) ); String.set fnam 0 ( Char.lowercase ( String.get fnam 0 ) );
try
let name = fnam ^ ".cmi" in let cmi_not_found () =
let file = List.find (
fun dir -> Sys.file_exists ( Filename.concat dir name )
) !Librarian.obj_path in
if file = "" then raise Not_found;
let file = Filename.concat file name in
let ml_cu = ML.CompUnit.from_bytecode file cu
and cd_cu = Ml_cduce.CompUnit.from_types_cu cu id in
Ml_checker.run ml_cu cd_cu;
let out = open_out ( Filename.concat out_dir (fnam ^ ".ml") ) in
let fmt = Format.formatter_of_out_channel out in
Ml_generator.ML.generate fmt fnam ml_cu cd_cu;
close_out out;
with Not_found -> (
let name = fnam ^ ".mli" in let name = fnam ^ ".mli" in
let has_cmi = List.exists ( let has_cmi = List.exists (
fun dir -> Sys.file_exists ( Filename.concat dir name ) fun dir -> Sys.file_exists ( Filename.concat dir name )
...@@ -304,7 +291,31 @@ ifdef ML_INTERFACE then ...@@ -304,7 +291,31 @@ ifdef ML_INTERFACE then
Format.eprintf Format.eprintf
"Warning: found %s.mli but no %s.cmi: forgotten compilation?@." "Warning: found %s.mli but no %s.cmi: forgotten compilation?@."
fnam fnam; fnam fnam;
) String.set fnam 0 ( Char.lowercase ( String.get fnam 0 ) );
in
let cmi_found file =
let ml_cu = ML.CompUnit.from_bytecode file cu
and cd_cu = Ml_cduce.CompUnit.from_types_cu cu id in
Ml_checker.run ml_cu cd_cu;
let out = open_out ( Filename.concat out_dir (fnam ^ ".ml") ) in
let fmt = Format.formatter_of_out_channel out in
Ml_generator.ML.generate fmt fnam ml_cu cd_cu;
close_out out
in
let name = fnam ^ ".cmi" in
let file =
try
let file = List.find (
fun dir -> Sys.file_exists ( Filename.concat dir name )
) !Librarian.obj_path in
if file = "" then None
else Some (Filename.concat file name)
with Not_found -> None
in
match file with
| Some file -> cmi_found file
| None -> cmi_not_found ()
else else
let check_ml cu id out_dir out = ();; let check_ml cu id out_dir out = ();;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment