Beispiel #1
0
        public static Doc Print(ObjectCreationExpressionSyntax node)
        {
            var groupId = Guid.NewGuid().ToString();

            return(Doc.Group(
                       Token.PrintWithSuffix(node.NewKeyword, " "),
                       Node.Print(node.Type),
                       node.ArgumentList != null
                    ? Doc.GroupWithId(
                           groupId,
                           ArgumentListLike.Print(
                               node.ArgumentList.OpenParenToken,
                               node.ArgumentList.Arguments,
                               node.ArgumentList.CloseParenToken
                               )
                           )
                    : Doc.Null,
                       node.Initializer != null
                    ? node.ArgumentList != null
                            ? InitializerExpression.PrintWithConditionalSpace(
                           node.Initializer,
                           groupId
                           )
                            : Doc.Concat(Doc.Line, InitializerExpression.Print(node.Initializer))
                    : Doc.Null
                       ));
        }
 public static Doc Print(StackAllocArrayCreationExpressionSyntax node)
 {
     return(Doc.Concat(
                Token.Print(node.StackAllocKeyword, " "),
                Node.Print(node.Type),
                node.Initializer != null
             ? Doc.Concat(" ", InitializerExpression.Print(node.Initializer))
             : string.Empty
                ));
 }
 public static Doc Print(ObjectCreationExpressionSyntax node)
 {
     return(Doc.Group(
                Token.Print(node.NewKeyword, " "),
                Node.Print(node.Type),
                node.ArgumentList != null ? ArgumentList.Print(node.ArgumentList) : string.Empty,
                node.Initializer != null
             ? InitializerExpression.Print(node.Initializer)
             : string.Empty
                ));
 }
Beispiel #4
0
        public static Doc Print(ImplicitArrayCreationExpressionSyntax node)
        {
            var commas = node.Commas.Select(Token.Print).ToArray();

            return(Doc.Group(
                       Token.Print(node.NewKeyword),
                       Token.Print(node.OpenBracketToken),
                       Doc.Concat(commas),
                       Token.Print(node.CloseBracketToken),
                       Doc.Line,
                       InitializerExpression.Print(node.Initializer)
                       ));
        }