Exemple #1
0
        private static bool WriteArrayElements(InitializerExpressionSyntax initializer, OutputWriter writer,
                                               Dictionary <int, int> inferred, int level, bool omitbraces = false, ITypeSymbol elementType = null)
        {
            level++;
            if (!omitbraces)
            {
                writer.Write("[");
            }

            bool first = true;

            if (!inferred.ContainsKey(level))
            {
                inferred.Add(level, initializer.Expressions.Count);
            }
            foreach (var iexpression in initializer.Expressions)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    writer.Write(",");
                }
                if (iexpression is InitializerExpressionSyntax)
                {
                    WriteArrayElements(iexpression as InitializerExpressionSyntax, writer, inferred, level, omitbraces);
                }
                else
                {
                    if (elementType != null)
                    {
                        // var type = TypeProcessor.GetTypeInfo(iexpression);
                        //Need to do this like a binary i.e. compare all
                        WriteBinaryExpression.WriteIt(writer, default(SyntaxToken), null, iexpression);
                        // Core.Write(writer, iexpression);
                    }
                    else
                    {
                        Core.Write(writer, iexpression);
                    }
                }
            }
            if (!omitbraces)
            {
                writer.Write("]");
            }
            return(first);
        }
 public static void Go(OutputWriter writer, AssignmentExpressionSyntax expression)
 {
     WriteBinaryExpression.WriteIt(writer, expression.OperatorToken, expression.Right, expression.Left);
 }