mgusmano / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

Support array initializers #248

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It's just syntactic sugar but would be nice to support shortened array 
initializers e.g.

int[] a = {0, 2, 4, 6, 8};

which currently results in

1>  SharpKit.Compiler.CompilerException: The method or operation is not 
implemented. ---> System.NotImplementedException: The method or operation is 
not implemented.
1>     at 
SharpKit.Compiler.JsCodeImporter.VisitArrayInitializerExpression(ArrayInitialize
rExpression node)
1>     at 
ICSharpCode.NRefactory.CSharp.ArrayInitializerExpression.AcceptVisitor[T](IAstVi
sitor`1 visitor)
1>     at SharpKit.Compiler.JsCodeImporter._Visit(AstNode node)
1>     at SharpKit.Compiler.JsCodeImporter.Visit(AstNode node)
1>     --- End of inner exception stack trace ---
1>     at SharpKit.Compiler.JsTypeImporter.Visit(IEntity node)
1>     at SharpKit.Compiler.JsModelImporter.ExportType(ITypeDefinition ce)
1>     at SharpKit.Compiler.JsModelImporter.ExportType(ITypeDefinition ce, 
JsFile jsFile)
1>     at 
SharpKit.Compiler.JsModelImporter.<>c__DisplayClass13.<ExportTypesInFile>b__12(I
TypeDefinition t)
1>     at System.Collections.Generic.List`1.ForEach(Action`1 action)
1>     at SharpKit.Compiler.JsModelImporter.ExportTypesInFile(KeyValuePair`2 p)
1>     at System.Linq.Extensions.ForEach[T](IEnumerable`1 items, Action`1 
action)
1>     at 
System.Collections.Generic.CollectionExtensions.ForEachParallel[T](IEnumerable`1
 items, Action`1 action, Boolean parallel)
1>     at SharpKit.Compiler.JsModelImporter.Process()
1>     at SharpKit.Compiler.CompilerTool.ConvertCsToJs()
1>     at SharpKit.Compiler.CompilerTool.Time(Action action)
1>     at SharpKit.Compiler.CompilerTool.InternalRun()

The more explicit form is accepted without issue.

int[] a = new int[] {0, 2, 4, 6, 8};
http://msdn.microsoft.com/en-us/library/aa664573(v=vs.71).aspx

SharpKit 5 Professional Edition v5.00.0000

Original issue reported on code.google.com by co...@gravill.com on 5 Nov 2012 at 4:43