Exemple #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(ArgumentListSyntax node)
 {
     return(node.Parent
            is not ObjectCreationExpressionSyntax
         ? Doc.Group(
                ArgumentListLike.Print(
                    node.OpenParenToken,
                    node.Arguments,
                    node.CloseParenToken
                    )
                )
         : ArgumentListLike.Print(node.OpenParenToken, node.Arguments, node.CloseParenToken));
 }
Exemple #3
0
 public static Doc Print(TupleExpressionSyntax node) =>
 Doc.Group(
     ArgumentListLike.Print(node.OpenParenToken, node.Arguments, node.CloseParenToken)
     );
Exemple #4
0
 public static Doc Print(ArgumentListSyntax node)
 {
     return(Doc.Group(
                ArgumentListLike.Print(node.OpenParenToken, node.Arguments, node.CloseParenToken)
                ));
 }