Преглед изворни кода

[java] Fix getEnumConstructors

Cauê Waneck пре 10 година
родитељ
комит
c3c1eba7c6
2 измењених фајлова са 7 додато и 4 уклоњено
  1. 2 2
      std/java/Lib.hx
  2. 5 2
      std/java/_std/Type.hx

+ 2 - 2
std/java/Lib.hx

@@ -81,8 +81,8 @@ package java;
 
 	/**
 		Returns a Haxe Array of a native Array.
-		It won't copy the contents of the native array, so unless any operation triggers an array resize,
-		all changes made to the Haxe array will affect the native array argument.
+		Unless `copy` is true, it won't copy the contents of the native array,
+		so unless any operation triggers an array resize, all changes made to the Haxe array will affect the native array argument.
 	**/
 	@:generic public static function array<T>(native:java.NativeArray<T>):Array<T>
 	{

+ 5 - 2
std/java/_std/Type.hx

@@ -330,8 +330,11 @@ using StringTools;
 	}
 
 	public static function getEnumConstructs( e : Enum<Dynamic> ) : Array<String> {
-		if (Reflect.hasField(e, "constructs"))
-			return untyped e.constructs.copy();
+		if (Reflect.hasField(e, "__hx_constructs"))
+		{
+			var ret:Array<String> = java.Lib.array(untyped e.__hx_constructs);
+			return ret.copy();
+		}
     var vals:java.NativeArray<java.lang.Enum<Dynamic>> = untyped e.values(), ret = [];
     for (i in 0...vals.length)
       ret[i] = vals[i].name();