aduros-mirrors/haxe — pull request #2 by aszlig (2013-03-28 09:48:42+00:00)
Title: Fix creating macro expressions from arrays.

Internally, arrays are padded by null values. This isn't a problem with non-macro operation, as `dec_array` is used. The latter correctly reads the length attribute and trims the null values off the real array.

Unfortunately, in the macro_lib this wasn't done, so have a look at the following small test program:

```Haxe
class MacroTest
{
macro public static function test()
{
var foo = [for (y in 1...4) y];
trace(foo);
return macro $v{foo};
}

public static function main():Void
{
trace(test());
}
}
```

Resulted in the following output:

```
MacroTest.hx:6: [1,2,3]
MacroTest.hx:12: [1,2,3,null]
```

Obviously the null value at the end shouldn't be there and it gets worse with arrays of bigger size:

```
[1,2,3,4,5,6,7,8,9,null,null,null,null,null,null,null]
```