Browse Source

[cs] Make arrayAlloc inline. See #3946

Cauê Waneck 10 years ago
parent
commit
d99b6521f8
2 changed files with 3 additions and 1 deletions
  1. 1 1
      std/cs/Lib.hx
  2. 2 0
      tests/unit/src/unit/issues/Issue3946.hx

+ 1 - 1
std/cs/Lib.hx

@@ -166,7 +166,7 @@ class Lib
 	/**
 		Allocates a new Haxe Array with a predetermined size
 	**/
-	public static function arrayAlloc<T>(size:Int):Array<T>
+	inline public static function arrayAlloc<T>(size:Int):Array<T>
 	{
 		return @:privateAccess Array.alloc(size);
 	}

+ 2 - 0
tests/unit/src/unit/issues/Issue3946.hx

@@ -5,6 +5,8 @@ class Issue3946 extends Test {
     function test() {
         var arr = cs.Lib.arrayAlloc(10);
         eq(arr.length, 10);
+				arr[0] = 5;
+				eq(arr[0],5);
     }
     #end
 }