소스 검색

added enumConstructor

Nicolas Cannasse 18 년 전
부모
커밋
bcd38e2995
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      std/Type.hx

+ 13 - 0
std/Type.hx

@@ -509,5 +509,18 @@ class Type {
 		return true;
 		return true;
 	}
 	}
 
 
+	/**
+		Returns the constructor of an enum
+	**/
+	public static function enumConstructor( e : Dynamic ) : String {
+	#if neko
+		return new String(e.tag);
+	#else flash9
+		return e.tag;
+	#else true
+		return e[0];
+	#end
+	}
+
 }
 }