Browse Source

Fixed build.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4417 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
03339ba83a
  1. 29
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
  2. 5
      src/Libraries/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs

29
src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs

@ -213,6 +213,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -213,6 +213,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Space();
}
}
void PrintFormattedCommaAndNewLine()
{
if (this.prettyPrintOptions.SpacesBeforeComma) {
outputFormatter.Space();
}
outputFormatter.PrintToken(Tokens.Comma);
outputFormatter.NewLine();
outputFormatter.Indent();
}
public override object TrackedVisitAttributeSection(AttributeSection attributeSection, object data)
{
@ -1280,12 +1289,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1280,12 +1289,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
void PrintIfSection(List<Statement> statements)
{
if (statements.Count == 1 && (statements[0] is BlockStatement)) {
OutputBlock((BlockStatement)statements[0],
prettyPrintOptions.StatementBraceStyle,
OutputBlock((BlockStatement)statements[0],
prettyPrintOptions.StatementBraceStyle,
prettyPrintOptions.PlaceElseOnNewLine);
return;
}
/* if (statements.Count != 1 || !(statements[0] is BlockStatement)) {
/* if (statements.Count != 1 || !(statements[0] is BlockStatement)) {
outputFormatter.Space();
}*/
if (statements.Count != 1) {
@ -1305,7 +1314,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1305,7 +1314,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
} else {
outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
}
/* if (statements.Count != 1 || !(statements[0] is BlockStatement)) {
/* if (statements.Count != 1 || !(statements[0] is BlockStatement)) {
outputFormatter.Space();
}*/
}
@ -1476,7 +1485,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1476,7 +1485,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
if (i == switchSection.Children.Count - 1) {
if (prettyPrintOptions.IndentBreakStatements)
outputFormatter.IndentationLevel = standardIndentLevel + 1;
else
else
outputFormatter.IndentationLevel = standardIndentLevel;
}
outputFormatter.Indent();
@ -1737,8 +1746,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1737,8 +1746,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
if (!tryCatchStatement.FinallyBlock.IsNull) {
if (prettyPrintOptions.PlaceFinallyOnNewLine) {
// if (!prettyPrintOptions.PlaceCatchOnNewLine)
// outputFormatter.NewLine ();
// if (!prettyPrintOptions.PlaceCatchOnNewLine)
// outputFormatter.NewLine ();
outputFormatter.Indent();
} else {
outputFormatter.Space();
@ -2939,10 +2948,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -2939,10 +2948,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
foreach (T node in list) {
node.AcceptVisitor(this, null);
if (i + 1 < list.Count) {
PrintFormattedComma();
if (alwaysBreakLine || (i + 1) % 10 == 0) {
outputFormatter.NewLine();
outputFormatter.Indent();
PrintFormattedCommaAndNewLine();
} else {
PrintFormattedComma();
}
}
i++;

5
src/Libraries/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs

@ -670,7 +670,10 @@ static int static_Test2_j = 0;"); @@ -670,7 +670,10 @@ static int static_Test2_j = 0;");
TestStatement("Dim i(1) As String",
"string[] i = new string[2];");
TestStatement("Dim i As String() = New String(1) {\"0\", \"1\"}",
"string[] i = new string[2] { \"0\", \"1\" };");
"string[] i = new string[2] {" + Environment.NewLine +
" \"0\"," + Environment.NewLine +
" \"1\"" + Environment.NewLine +
"};");
TestStatement("Dim i As String(,) = New String(5, 5) {}",
"string[,] i = new string[6, 6];");
}

Loading…
Cancel
Save