Parcourir la source

bugfix haxe.rtti.Generic on private class

Nicolas Cannasse il y a 15 ans
Parent
commit
f70cf489a0
2 fichiers modifiés avec 4 ajouts et 5 suppressions
  1. 1 0
      doc/CHANGES.txt
  2. 3 5
      typeload.ml

+ 1 - 0
doc/CHANGES.txt

@@ -39,6 +39,7 @@
 	all : added completion for sub-types declarations
 	all : improved completion with lambda function
 	as3 : several generation fixes
+	all : bugfix haxe.rtti.Generic on private class
 
 2009-07-26: 2.04
 	flash9 : fixed get_full_path error with -D fdb

+ 3 - 5
typeload.ml

@@ -827,16 +827,14 @@ let type_module ctx m tdecls loadp =
 	let decls = ref [] in
 	let decl_with_name name p priv =
 		let tpath = if priv then (fst m @ ["_" ^ snd m], name) else (fst m, name) in
-		if priv then begin
-			if List.exists (fun t -> tpath = t_path t) (!decls) then error ("Type name " ^ name ^ " is alreday defined in this module") p;
-			tpath
-		end else try
+		if priv && List.exists (fun t -> tpath = t_path t) (!decls) then error ("Type name " ^ name ^ " is already defined in this module") p;
+		try
 			let m2 = Hashtbl.find ctx.types_module tpath in
 			if m <> m2 && String.lowercase (s_type_path m2) = String.lowercase (s_type_path m) then error ("Module " ^ s_type_path m2 ^ " is loaded with a different case than " ^ s_type_path m) loadp;
 			error ("Type name " ^ s_type_path tpath ^ " is redefined from module " ^ s_type_path m2) p
 		with
 			Not_found ->
-				Hashtbl.add ctx.types_module (fst m,name) m;
+				Hashtbl.add ctx.types_module tpath m;
 				tpath
 	in
 	List.iter (fun (d,p) ->