From 92086ff64b6dd04b95fa3e1aacb363a92f718c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 13 Mar 2009 16:52:00 +0000 Subject: [PATCH] * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Respected the aroundassignment option in more constructs. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3850 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../CSharp/CSharpOutputVisitor.cs | 64 ++++++++++++++----- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs index 5db0a810f9..de90bc649b 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs @@ -263,9 +263,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter public override object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) { outputFormatter.PrintIdentifier(namedArgumentExpression.Name); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Assign); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } TrackVisit(namedArgumentExpression.Expression, data); return null; } @@ -279,9 +283,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintIdentifier(@using.Name); if (@using.IsAlias) { - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Assign); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } TrackVisit(@using.Alias, data); } @@ -335,9 +343,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Indent(); outputFormatter.PrintIdentifier(f.Name); if (f.Initializer != null && !f.Initializer.IsNull) { - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Assign); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } TrackVisit(f.Initializer, data); } if (i < typeDeclaration.Children.Count - 1) { @@ -527,9 +539,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.CloseSquareBracket); } if (!variableDeclaration.Initializer.IsNull) { - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Assign); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } TrackVisit(variableDeclaration.Initializer, data); } return null; @@ -604,9 +620,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintIdentifier(eventDeclaration.Name); if (!eventDeclaration.Initializer.IsNull) { - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Assign); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } TrackVisit(eventDeclaration.Initializer, data); } @@ -1071,9 +1091,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Indent(); } TrackVisit(eraseStatement.Expressions[i], data); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Assign); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Null); outputFormatter.PrintToken(Tokens.Semicolon); } @@ -1696,9 +1720,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } else { TrackVisit(forNextStatement.LoopVariableExpression, data); } - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Assign); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } TrackVisit(forNextStatement.Start, data); outputFormatter.PrintToken(Tokens.Semicolon); outputFormatter.Space(); @@ -2751,9 +2779,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.Let); outputFormatter.Space(); outputFormatter.PrintIdentifier(letClause.Identifier); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.Assign); - outputFormatter.Space(); + if (this.prettyPrintOptions.AroundAssignmentParentheses) { + outputFormatter.Space(); + } return letClause.Expression.AcceptVisitor(this, data); }