Procházet zdrojové kódy

allow extra static vars in fakeEnum abstract

Nicolas Cannasse před 12 roky
rodič
revize
7953c43618
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      std/haxe/macro/Build.hx

+ 4 - 1
std/haxe/macro/Build.hx

@@ -37,9 +37,12 @@ class Build {
 		var tThis = a.get().type;
 		var ctA = TAbstract(a, []).toComplexType();
 		for (field in fields) {
-			field.access = [AStatic,APublic,AInline];
+			// allow extra static fields
+			if( Lambda.has(field.access,AStatic) )
+				continue;
 			switch(field.kind) {
 				case FVar(t, e):
+					field.access = [AStatic,APublic,AInline];
 					if (e == null) Context.error("Value required", field.pos);
 					var tE = Context.typeof(e);
 					if (!Context.unify(tE, tThis)) Context.error('${tE.toString()} should be ${tThis.toString()}', e.pos);