From f521b44db3be467b6f11a8e87a22636839145a0f Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 18 Jun 2006 12:50:00 +0000 Subject: [PATCH] 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 --- .../Project/Src/Output/VBNet/VBNetOutputVisitor.cs | 8 +++++++- .../Test/Output/VBNet/CSharpToVBConverterTest.cs | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs index 5aa3a6bf0c..bccd95799e 100644 --- a/src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs @@ -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(); diff --git a/src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs b/src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs index ecd4cdc786..017adf5410 100644 --- a/src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs +++ b/src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs @@ -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"); + } } }