Browse Source

Fixed SD2-883: C# to VB conversion error when having a 'while()' statement in one line

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1499 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
f521b44db3
  1. 8
      src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs
  2. 9
      src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs

8
src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs

@ -1613,7 +1613,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1613,7 +1613,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
PrintIndentedBlock(doLoopStatement.EmbeddedStatement);
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.Loop);
if (doLoopStatement.ConditionPosition == ConditionPosition.Start && doLoopStatement.ConditionType == ConditionType.While) {
outputFormatter.PrintToken(Tokens.End);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.While);
} else {
outputFormatter.PrintToken(Tokens.Loop);
}
if (doLoopStatement.ConditionPosition == ConditionPosition.End && !doLoopStatement.Condition.IsNull) {
outputFormatter.Space();

9
src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs

@ -336,5 +336,14 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -336,5 +336,14 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
TestStatement("c = a ?? b;",
"c = IIf(a Is Nothing, b, a)");
}
[Test]
public void ConvertedLoop()
{
TestStatement("while (cond) example();",
"While cond\n" +
"\texample()\n" +
"End While");
}
}
}

Loading…
Cancel
Save