Explorar o código

added enumConstructor

Nicolas Cannasse %!s(int64=18) %!d(string=hai) anos
pai
achega
bcd38e2995
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      std/Type.hx

+ 13 - 0
std/Type.hx

@@ -509,5 +509,18 @@ class Type {
 		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
+	}
+
 }