Browse Source

supported :extern removal for member fields as well

Nicolas Cannasse 13 years ago
parent
commit
898d4a2097
1 changed files with 11 additions and 2 deletions
  1. 11 2
      codegen.ml

+ 11 - 2
codegen.ml

@@ -499,12 +499,21 @@ let on_generate ctx t =
 			c.cl_ordered_statics <- f :: c.cl_ordered_statics;
 			c.cl_statics <- PMap.add f.cf_name f c.cl_statics;
 		end;
-		if not ctx.in_macro then List.iter (fun f ->
-			if f.cf_kind = Method MethMacro || has_meta ":extern" f.cf_meta then begin
+		let do_remove f =
+			(not ctx.in_macro && f.cf_kind = Method MethMacro) || has_meta ":extern" f.cf_meta
+		in
+		List.iter (fun f ->
+			if do_remove f then begin
 				c.cl_statics <- PMap.remove f.cf_name c.cl_statics;
 				c.cl_ordered_statics <- List.filter (fun f2 -> f != f2) c.cl_ordered_statics;
 			end
 		) c.cl_ordered_statics;
+		List.iter (fun f ->
+			if do_remove f then begin
+				c.cl_fields <- PMap.remove f.cf_name c.cl_fields;
+				c.cl_ordered_fields <- List.filter (fun f2 -> f != f2) c.cl_ordered_fields;
+			end
+		) c.cl_ordered_fields;
 		(match build_metadata ctx.com t with
 		| None -> ()
 		| Some e ->