2
0
Эх сурвалжийг харах

[java] Fix `Vector#toArray`. Closes #4979

Cauê Waneck 9 жил өмнө
parent
commit
faeda7ba41

+ 1 - 1
std/haxe/ds/Vector.hx

@@ -179,7 +179,7 @@ abstract Vector<T>(VectorData<T>) {
 	/**
 		Creates a new Array, copy the content from the Vector to it, and returns it.
 	**/
-	public #if (flash || cpp || js) inline #end function toArray():Array<T> {
+	public #if (flash || cpp || js || java) inline #end function toArray():Array<T> {
 		#if cpp
 			return this.copy();
 		#elseif python

+ 13 - 0
tests/unit/src/unit/issues/Issue4979.hx

@@ -0,0 +1,13 @@
+package unit.issues;
+
+class Issue4979 extends Test {
+  function test() {
+    var vec = new haxe.ds.Vector<Int>(10);
+    var arr = run(vec.toArray());
+    eq(arr.length, 10);
+  }
+
+  static public function run(items:Array<Int>) {
+    return items;
+  }
+}