Revu detection definitions multiples (PR#1732)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5628 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 2003-06-27 08:49:22 +00:00
parent ccd0578b78
commit 9ca07e88e2
1 changed files with 6 additions and 3 deletions

View File

@ -35,7 +35,8 @@ exception Error of error
let crc_interfaces = Consistbl.create () let crc_interfaces = Consistbl.create ()
let crc_implementations = Consistbl.create () let crc_implementations = Consistbl.create ()
let extra_implementations = ref [] let extra_implementations = ref ([] : string list)
let implementations_defined = ref ([] : (string * string) list)
let check_consistency file_name unit crc = let check_consistency file_name unit crc =
begin try begin try
@ -60,11 +61,13 @@ let check_consistency file_name unit crc =
raise(Error(Inconsistent_implementation(name, user, auth))) raise(Error(Inconsistent_implementation(name, user, auth)))
end; end;
begin try begin try
let source = Consistbl.source crc_implementations unit.ui_name in let source = List.assoc unit.ui_name !implementations_defined in
raise (Error(Multiple_definition(unit.ui_name, file_name, source))) raise (Error(Multiple_definition(unit.ui_name, file_name, source)))
with Not_found -> () with Not_found -> ()
end; end;
Consistbl.set crc_implementations unit.ui_name crc file_name Consistbl.set crc_implementations unit.ui_name crc file_name;
implementations_defined :=
(unit.ui_name, file_name) :: !implementations_defined
let extract_crc_interfaces () = let extract_crc_interfaces () =
Consistbl.extract crc_interfaces Consistbl.extract crc_interfaces