Browse Source

[net-lib] Only add events that have different names from other events/properties/fields/methods

Cauê Waneck 10 years ago
parent
commit
a8a5b54d1e
2 changed files with 15 additions and 1 deletions
  1. 14 0
      gencs.ml
  2. 1 1
      libs

+ 14 - 0
gencs.ml

@@ -3960,6 +3960,13 @@ let normalize_ilcls ctx cls =
 	let no_overrides = ref no_overrides in
 
 	let all_fields = ref [] in
+	let all_events_name = Hashtbl.create 0 in
+	let add_cls_events_collision cls =
+		List.iter (fun ev -> Hashtbl.replace all_events_name ev.ename true) cls.cevents;
+		List.iter (fun f -> if not (List.mem CStatic f.fflags.ff_contract) then Hashtbl.replace all_events_name f.fname true) cls.cfields;
+		List.iter (fun m -> if not (List.mem CMStatic m.mflags.mf_contract) then Hashtbl.replace all_events_name m.mname true) cls.cmethods;
+	in
+
 	let rec loop cls = try
 		match cls.csuper with
 		| Some { snorm = LClass((["System"],[],"Object"),_) }
@@ -3976,10 +3983,16 @@ let normalize_ilcls ctx cls =
 				not is_override_here
 			) !no_overrides;
 			all_fields := get_all_fields cls @ !all_fields;
+
+			add_cls_events_collision cls;
+			List.iter (fun p -> if not (is_static (IlProp p)) then Hashtbl.replace all_events_name p.pname true) cls.cprops;
+
 			loop cls
 		with | Not_found -> ()
 	in
 	loop cls;
+
+	add_cls_events_collision cls;
 	List.iter (fun v -> v := { !v with moverride = None }) !no_overrides;
 	let added = ref [] in
 
@@ -4066,6 +4079,7 @@ let normalize_ilcls ctx cls =
 		cfields = List.map (function | (IlField f,_,_,_) -> f | _ -> assert false) fields;
 		cprops = List.map (function | (IlProp f,_,_,_) -> f | _ -> assert false) props;
 		cmethods = methods;
+		cevents = List.filter (fun ev -> not (Hashtbl.mem all_events_name ev.ename)) cls.cevents;
 	}
 
 let add_net_std com file =

+ 1 - 1
libs

@@ -1 +1 @@
-Subproject commit e0422f1e7446459ee18050a4328a6f1ded25dc4e
+Subproject commit 1411604759eaeb88468a77e8ef890dcc210e4509