浏览代码

allow extra static vars in fakeEnum abstract

Nicolas Cannasse 12 年之前
父节点
当前提交
7953c43618
共有 1 个文件被更改,包括 4 次插入1 次删除
  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 tThis = a.get().type;
 		var ctA = TAbstract(a, []).toComplexType();
 		var ctA = TAbstract(a, []).toComplexType();
 		for (field in fields) {
 		for (field in fields) {
-			field.access = [AStatic,APublic,AInline];
+			// allow extra static fields
+			if( Lambda.has(field.access,AStatic) )
+				continue;
 			switch(field.kind) {
 			switch(field.kind) {
 				case FVar(t, e):
 				case FVar(t, e):
+					field.access = [AStatic,APublic,AInline];
 					if (e == null) Context.error("Value required", field.pos);
 					if (e == null) Context.error("Value required", field.pos);
 					var tE = Context.typeof(e);
 					var tE = Context.typeof(e);
 					if (!Context.unify(tE, tThis)) Context.error('${tE.toString()} should be ${tThis.toString()}', e.pos);
 					if (!Context.unify(tE, tThis)) Context.error('${tE.toString()} should be ${tThis.toString()}', e.pos);