kswoll / WootzJs

C# to Javascript Compiler implemented via Roslyn
MIT License
110 stars 21 forks source link

Support for ArrayInitializer #8

Closed Danielku15 closed 10 years ago

Danielku15 commented 10 years ago

If you are using array initializers, the compiler crashes:

int[] test = {1, 2, 3};

The (empty) implementation part is currently commented in JsTransformer.VisitInitializerExpression(). The compiler completely crashes because the initializableObjectsStack is empty and peek throws an InvalidOperationException.

kswoll commented 10 years ago

Thanks for the catch! Was handling typed array initializers, i.e.:

var x = new int[] { 1, 2, 3};

But was not handling the syntax you reported. Fixed now.