From 1e6aefef7eb460c0016c83e7de0a926982cfc570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Mon, 16 Mar 2009 07:02:29 +0000 Subject: [PATCH] * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: fixed bracket space output issues. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3855 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs index a70ac4eac5..6ddb0a3bb2 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs @@ -142,13 +142,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter { for (int i = startRankIndex; i < rankSpecifier.Length; ++i) { outputFormatter.PrintToken(Tokens.OpenSquareBracket); - if (this.prettyPrintOptions.SpacesWithinBrackets) { + bool outputSpace = this.prettyPrintOptions.SpacesWithinBrackets && rankSpecifier[i] > 0; + if (outputSpace) { outputFormatter.Space(); } for (int j = 0; j < rankSpecifier[i]; ++j) { outputFormatter.PrintToken(Tokens.Comma); } - if (this.prettyPrintOptions.SpacesWithinBrackets) { + if (outputSpace) { outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.CloseSquareBracket); @@ -2680,14 +2681,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (arrayCreateExpression.Arguments.Count > 0) { outputFormatter.PrintToken(Tokens.OpenSquareBracket); - if (this.prettyPrintOptions.SpacesWithinBrackets) { + bool outputSpace = this.prettyPrintOptions.SpacesWithinBrackets && arrayCreateExpression.Arguments.Count > 0; + if (outputSpace) { outputFormatter.Space(); } for (int i = 0; i < arrayCreateExpression.Arguments.Count; ++i) { if (i > 0) PrintFormattedComma(); TrackVisit(arrayCreateExpression.Arguments[i], data); } - if (this.prettyPrintOptions.SpacesWithinBrackets) { + if (outputSpace) { outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.CloseSquareBracket);