Jelajahi Sumber

add toString for Xml.XmlType enum abstract

Dan Korostelev 6 tahun lalu
induk
melakukan
d8feb6f42b
1 mengubah file dengan 12 tambahan dan 0 penghapusan
  1. 12 0
      std/Xml.hx

+ 12 - 0
std/Xml.hx

@@ -54,6 +54,18 @@ enum abstract XmlType(Int) {
 		Represents an XML document type.
 	**/
 	var Document = 6;
+
+	public function toString():String {
+		return switch (cast this : XmlType) {
+			case Element: "Element";
+			case PCData: "PCData";
+			case CData: "CData";
+			case Comment: "Comment";
+			case DocType: "DocType";
+			case ProcessingInstruction: "ProcessingInstruction";
+			case Document: "Document";
+		};
+	}
 }
 
 /**