Quellcode durchsuchen

don't include overriden fields in doc.

Nicolas Cannasse vor 18 Jahren
Ursprung
Commit
656b6bd485
1 geänderte Dateien mit 15 neuen und 1 gelöschten Zeilen
  1. 15 1
      genxml.ml

+ 15 - 1
genxml.ml

@@ -102,12 +102,26 @@ let gen_type_params priv path params pos m =
 let gen_class_path name (c,pl) =
 let gen_class_path name (c,pl) =
 	node name [("path",s_type_path c.cl_path)] (List.map gen_ptype pl)
 	node name [("path",s_type_path c.cl_path)] (List.map gen_ptype pl)
 
 
+let rec exists f c =
+	try
+		let f2 = PMap.find f.cf_name c.cl_fields in
+		not (type_eq false f.cf_type f2.cf_type)
+	with
+		Not_found ->
+			match c.cl_super with
+			| None -> true
+			| Some (csup,_) -> exists f csup
+
 let gen_type ctx t =
 let gen_type ctx t =
 	let m = Typer.module_of_type ctx t in
 	let m = Typer.module_of_type ctx t in
 	match t with
 	match t with
 	| TClassDecl c ->
 	| TClassDecl c ->
 		let stats = List.map (gen_field ["static","1"]) c.cl_ordered_statics in
 		let stats = List.map (gen_field ["static","1"]) c.cl_ordered_statics in
-		let fields = List.map (gen_field []) c.cl_ordered_fields in
+		let fields = (match c.cl_super with
+			| None -> c.cl_ordered_fields
+			| Some (csup,_) -> List.filter (fun f -> exists f csup) c.cl_ordered_fields
+		) in
+		let fields = List.map (gen_field []) fields in
 		let constr = (match c.cl_constructor with None -> [] | Some f -> [gen_field [] f]) in
 		let constr = (match c.cl_constructor with None -> [] | Some f -> [gen_field [] f]) in
 		let impl = List.map (gen_class_path "implements") c.cl_implements in
 		let impl = List.map (gen_class_path "implements") c.cl_implements in
 		let tree = (match c.cl_super with
 		let tree = (match c.cl_super with