protected virtual void _Generate(AstNodeExprNewArray array)
 {
     Output.Write("new " + array.ElementType + "[] { ");
     for (int n = 0; n < array.Length; n++)
     {
         if (n != 0)
         {
             Output.Write(", ");
         }
         Generate(array.Values[n]);
     }
     Output.Write(" }");
 }
Exemple #2
0
        protected virtual void _Generate(AstNodeExprNewArray NewArray)
        {
            var TempArrayLocal = AstLocal.Create(NewArray.Type, "$TempArray");

            Generate(new AstNodeExprImm(NewArray.Length));
            Emit(OpCodes.Newarr, NewArray.ElementType);
            Emit(OpCodes.Stloc, _GetLocalBuilderFromAstLocal(TempArrayLocal));
            for (int n = 0; n < NewArray.Length; n++)
            {
                Generate(new AstNodeStmAssign(new AstNodeExprArrayAccess(new AstNodeExprLocal(TempArrayLocal), n), NewArray.Values[n]));
            }
            Generate(new AstNodeExprLocal(TempArrayLocal));
        }