Browse Source

Fixed C# <-> VB conversion bugs.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1434 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
2de421c5a9
  1. 1
      src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs
  2. 3
      src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs
  3. 7
      src/Libraries/NRefactory/Test/Output/CSharp/VBToCSharpConverterTest.cs
  4. 11
      src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs

1
src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs

@ -1693,6 +1693,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1693,6 +1693,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
nodeTracker.TrackedVisit(binaryOperatorExpression.Left, data);
switch (binaryOperatorExpression.Op) {
case BinaryOperatorType.Add:
case BinaryOperatorType.Concat: // translate Concatenation to +
if (prettyPrintOptions.AroundAdditiveOperatorParentheses) {
outputFormatter.Space();
}

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

@ -908,7 +908,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -908,7 +908,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Property);
outputFormatter.Space();
outputFormatter.PrintIdentifier("ConvertedIndexer");
outputFormatter.PrintIdentifier("Item");
outputFormatter.PrintToken(Tokens.OpenParenthesis);
AppendCommaSeparatedList(indexerDeclaration.Parameters);
@ -931,7 +931,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -931,7 +931,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.End);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Property);
outputFormatter.Space();
outputFormatter.NewLine();
return null;
}

7
src/Libraries/NRefactory/Test/Output/CSharp/VBToCSharpConverterTest.cs

@ -224,6 +224,13 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -224,6 +224,13 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"Equals(a, b);");
}
[Test]
public void Concatenation()
{
TestStatement("x = \"Hello \" & \"World\"",
"x = \"Hello \" + \"World\";");
}
[Test]
public void VBConstants()
{

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

@ -238,6 +238,17 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -238,6 +238,17 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"End Sub");
}
[Test]
public void Indexer()
{
TestMember("public CategoryInfo this[int index] { get { return List[index] as CategoryInfo; } }",
"Public Default ReadOnly Property Item(ByVal index As Integer) As CategoryInfo\n" +
"\tGet\n" +
"\t\tReturn TryCast(List(index), CategoryInfo)\n" +
"\tEnd Get\n" +
"End Property");
}
[Test]
public void RenameConflictingNames()
{

Loading…
Cancel
Save