diff options
author | Daniel Grunwald <daniel@danielgrunwald.de> | 2016-11-23 20:24:39 +0300 |
---|---|---|
committer | Daniel Grunwald <daniel@danielgrunwald.de> | 2016-11-23 20:24:55 +0300 |
commit | 2b10193ea20a26ae9c8db21a79c60f3be8d8cca8 (patch) | |
tree | a2ccb1fa7c6b3bdab8e31689e91921e7e78fd0f2 | |
parent | 612848ef567c43765e2dd31c158933e34fc429e4 (diff) |
CSharpOutputVisitor: use policy.CatchNewLinePlacement and policy.FinallyNewLinePlacement
-rw-r--r-- | ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs | 15 |
1 files 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); } |