Skip to content

Commit

Permalink
fixing issues after mergin
Browse files Browse the repository at this point in the history
  • Loading branch information
belav committed May 21, 2022
1 parent 6a01f85 commit 584046e
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 20 deletions.
5 changes: 4 additions & 1 deletion Src/CSharpier/SyntaxPrinter/ConstraintClauses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ namespace CSharpier.SyntaxPrinter;

internal static class ConstraintClauses
{
public static Doc Print(IEnumerable<TypeParameterConstraintClauseSyntax> constraintClauses)
public static Doc Print(
IEnumerable<TypeParameterConstraintClauseSyntax> constraintClauses,
FormattingContext context
)
{
var constraintClausesList = constraintClauses.ToList();

Expand Down
3 changes: 2 additions & 1 deletion Src/CSharpier/SyntaxPrinter/SeparatedSyntaxList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ internal static class SeparatedSyntaxList
{
public static Doc Print<T>(
SeparatedSyntaxList<T> list,
Func<T, Doc> printFunc,
Func<T, FormattingContext, Doc> printFunc,
Doc afterSeparator,
FormattingContext context,
int startingIndex = 0
) where T : SyntaxNode
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static Doc Print(CSharpSyntaxNode node, FormattingContext context)
Doc.Group(
Doc.Indent(Doc.Line),
Doc.Indent(colonToken),
Token.Print(constructorInitializer.ThisOrBaseKeyword),
Token.Print(constructorInitializer.ThisOrBaseKeyword, context),
Doc.Indent(argumentList)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public static Doc Print(BaseTypeDeclarationSyntax node, FormattingContext contex
Doc.Indent(
MembersWithForcedLines.Print(
typeDeclarationSyntax,
typeDeclarationSyntax.Members
typeDeclarationSyntax.Members,
context
)
);
}
Expand Down Expand Up @@ -55,7 +56,8 @@ public static Doc Print(BaseTypeDeclarationSyntax node, FormattingContext contex
Doc.Indent(
MembersWithForcedLines.Print(
enumDeclarationSyntax,
enumDeclarationSyntax.Members
enumDeclarationSyntax.Members,
context
)
);
}
Expand Down Expand Up @@ -102,15 +104,16 @@ public static Doc Print(BaseTypeDeclarationSyntax node, FormattingContext contex
var baseListDoc = Doc.Concat(
Token.Print(node.BaseList.ColonToken, context),
" ",
Node.Print(node.BaseList.Types.First()),
Node.Print(node.BaseList.Types.First(), context),
node.BaseList.Types.Count > 1
? Doc.Indent(
Token.Print(node.BaseList.Types.GetSeparator(0)),
Token.Print(node.BaseList.Types.GetSeparator(0), context),
Doc.Line,
SeparatedSyntaxList.Print(
node.BaseList.Types,
Node.Print,
Doc.Line,
context,
startingIndex: 1
)
)
Expand All @@ -130,7 +133,7 @@ public static Doc Print(BaseTypeDeclarationSyntax node, FormattingContext contex

docs.Add(
Doc.HardLine,
Token.Print(node.OpenBraceToken),
Token.Print(node.OpenBraceToken, context),
membersContent,
Doc.HardLine,
Token.Print(node.CloseBraceToken, context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public static Doc Print(CasePatternSwitchLabelSyntax node, FormattingContext con
{
return Doc.Concat(
ExtraNewLines.Print(node),
Token.PrintWithSuffix(node.Keyword, " "),
Node.Print(node.Pattern),
node.WhenClause != null ? WhenClause.Print(node.WhenClause) : Doc.Null,
Token.Print(node.ColonToken)
Token.PrintWithSuffix(node.Keyword, " ", context),
Node.Print(node.Pattern, context),
node.WhenClause != null ? WhenClause.Print(node.WhenClause, context) : Doc.Null,
Token.Print(node.ColonToken, context)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ public static Doc Print(ConditionalExpressionSyntax node, FormattingContext cont
Doc[] innerContents =
{
Doc.Line,
Token.PrintWithSuffix(node.QuestionToken, " "),
Doc.Concat(Node.Print(node.WhenTrue)),
Token.PrintWithSuffix(node.QuestionToken, " ", context),
Doc.Concat(Node.Print(node.WhenTrue, context)),
Doc.Line,
Token.PrintWithSuffix(node.ColonToken, " "),
Doc.Concat(Node.Print(node.WhenFalse))
Token.PrintWithSuffix(node.ColonToken, " ", context),
Doc.Concat(Node.Print(node.WhenFalse, context))
};

Doc[] outerContents =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public static Doc Print(SwitchExpressionSyntax node, FormattingContext context)
Doc.Concat(
ExtraNewLines.Print(o),
Doc.Group(
Node.Print(o.Pattern),
o.WhenClause != null ? Node.Print(o.WhenClause) : Doc.Null,
Node.Print(o.Pattern, context),
o.WhenClause != null ? Node.Print(o.WhenClause, context) : Doc.Null,
Doc.Indent(
Doc.Concat(
Doc.Line,
Expand Down
4 changes: 2 additions & 2 deletions Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/WhenClause.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public static Doc Print(WhenClauseSyntax node, FormattingContext context)
return Doc.Group(
Doc.Indent(
Doc.Line,
Token.PrintWithSuffix(node.WhenKeyword, " "),
Node.Print(node.Condition)
Token.PrintWithSuffix(node.WhenKeyword, " ", context),
Node.Print(node.Condition, context)
)
);
}
Expand Down

0 comments on commit 584046e

Please sign in to comment.