Ver Fonte

do not generate null inits if no Type.getClassFields/getInstanceFields

Nicolas Cannasse há 13 anos atrás
pai
commit
c7684fb726
2 ficheiros alterados com 9 adições e 2 exclusões
  1. 1 0
      doc/CHANGES.txt
  2. 8 2
      genjs.ml

+ 1 - 0
doc/CHANGES.txt

@@ -15,6 +15,7 @@
 	js : remove $hxClasses generation if Type.resolveClass/resolveEnum not referenced
 	flash : bugfix for @:bitmap with 24-bits PNG (flash decode wrong colors)
 	as3 : fixed EnumValue becomes Object
+	js : removed js.Lib.isIE/isOpera (not complete, use js.JQuery.browser instead)
 
 2012-04-14: 2.09
 	all : optimized const == const and const != const (with different const types)

+ 8 - 2
genjs.ml

@@ -849,6 +849,8 @@ let check_field_name c f stat =
 let gen_class_static_field ctx c f =
 	check_field_name c f true;
 	match f.cf_expr with
+	| None | Some { eexpr = TConst TNull } when not (has_feature ctx "Type.getClassFields") ->
+		()
 	| None ->
 		print ctx "%s%s = null" (s_path ctx c.cl_path) (field f.cf_name);
 		newline ctx
@@ -867,12 +869,16 @@ let gen_class_static_field ctx c f =
 
 let gen_class_field ctx c f =
 	check_field_name c f false;
-	newprop ctx;
-	print ctx "%s: " (anon_field f.cf_name);
 	match f.cf_expr with
+	| None | Some { eexpr = TConst TNull } when not (has_feature ctx "Type.getInstanceFields") ->
+		()
 	| None ->
+		newprop ctx;
+		print ctx "%s: " (anon_field f.cf_name);
 		print ctx "null";
 	| Some e ->
+		newprop ctx;
+		print ctx "%s: " (anon_field f.cf_name);
 		ctx.id_counter <- 0;
 		gen_value ctx e;
 		ctx.separator <- false