From 2b10193ea20a26ae9c8db21a79c60f3be8d8cca8 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 23 Nov 2016 18:24:39 +0100 Subject: CSharpOutputVisitor: use policy.CatchNewLinePlacement and policy.FinallyNewLinePlacement --- .../OutputVisitor/CSharpOutputVisitor.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs index bbed832d..769c4e09 100644 --- a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs @@ -1660,14 +1660,23 @@ namespace ICSharpCode.NRefactory.CSharp { StartNode(tryCatchStatement); WriteKeyword(TryCatchStatement.TryKeywordRole); - tryCatchStatement.TryBlock.AcceptVisitor(this); + WriteBlock(tryCatchStatement.TryBlock, policy.StatementBraceStyle); foreach (var catchClause in tryCatchStatement.CatchClauses) { + if (policy.CatchNewLinePlacement == NewLinePlacement.SameLine) + Space(); + else + NewLine(); catchClause.AcceptVisitor(this); } if (!tryCatchStatement.FinallyBlock.IsNull) { + if (policy.FinallyNewLinePlacement == NewLinePlacement.SameLine) + Space(); + else + NewLine(); WriteKeyword(TryCatchStatement.FinallyKeywordRole); - tryCatchStatement.FinallyBlock.AcceptVisitor(this); + WriteBlock(tryCatchStatement.FinallyBlock, policy.StatementBraceStyle); } + NewLine(); EndNode(tryCatchStatement); } @@ -1697,7 +1706,7 @@ namespace ICSharpCode.NRefactory.CSharp Space(policy.SpacesWithinIfParentheses); RPar(); } - catchClause.Body.AcceptVisitor(this); + WriteBlock(catchClause.Body, policy.StatementBraceStyle); EndNode(catchClause); } -- cgit v1.2.3