Browse Source

Fixed forum-18391 and forum-18392 (pretty printer bugs).

VBNetOutputVisitor: Don't output "ByVal" by default.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2660 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
b78656bd6f
  1. 23
      src/Libraries/NRefactory/Project/Src/OperatorPrecedence.cs
  2. 3
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
  3. 13
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
  4. 7
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs
  5. 4
      src/Libraries/NRefactory/Test/NRefactoryTests.csproj
  6. 152
      src/Libraries/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs
  7. 5
      src/Libraries/NRefactory/Test/Output/SpecialOutputVisitorTest.cs
  8. 141
      src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBNetConverterTest.cs
  9. 1
      src/Libraries/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs
  10. 2
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  11. 7
      src/Main/Base/Project/Src/Project/MSBuildEngine.cs
  12. 20
      src/Main/Base/Test/CodeConverterTests.cs

23
src/Libraries/NRefactory/Project/Src/OperatorPrecedence.cs

@ -36,6 +36,22 @@ namespace ICSharpCode.NRefactory
new BinaryOperatorType[] { BinaryOperatorType.ExclusiveOr } new BinaryOperatorType[] { BinaryOperatorType.ExclusiveOr }
); );
static readonly Dictionary<BinaryOperatorType, int> csharpDict = MakePrecedenceTable(
new BinaryOperatorType[] { BinaryOperatorType.Multiply, BinaryOperatorType.Divide, BinaryOperatorType.Modulus },
new BinaryOperatorType[] { BinaryOperatorType.Add, BinaryOperatorType.Subtract },
new BinaryOperatorType[] { BinaryOperatorType.ShiftLeft, BinaryOperatorType.ShiftRight },
new BinaryOperatorType[] {
BinaryOperatorType.LessThan, BinaryOperatorType.LessThanOrEqual,
BinaryOperatorType.GreaterThan, BinaryOperatorType.GreaterThanOrEqual,
},
new BinaryOperatorType[] { BinaryOperatorType.Equality, BinaryOperatorType.InEquality },
new BinaryOperatorType[] { BinaryOperatorType.BitwiseAnd },
new BinaryOperatorType[] { BinaryOperatorType.ExclusiveOr },
new BinaryOperatorType[] { BinaryOperatorType.BitwiseOr },
new BinaryOperatorType[] { BinaryOperatorType.LogicalAnd, BinaryOperatorType.LogicalOr },
new BinaryOperatorType[] { BinaryOperatorType.NullCoalescing }
);
// create a dictionary operator->precedence (higher value = higher precedence) // create a dictionary operator->precedence (higher value = higher precedence)
static Dictionary<BinaryOperatorType, int> MakePrecedenceTable(params BinaryOperatorType[][] input) static Dictionary<BinaryOperatorType, int> MakePrecedenceTable(params BinaryOperatorType[][] input)
{ {
@ -55,6 +71,13 @@ namespace ICSharpCode.NRefactory
return p1.CompareTo(p2); return p1.CompareTo(p2);
} }
public static int ComparePrecedenceCSharp(BinaryOperatorType op1, BinaryOperatorType op2)
{
int p1 = GetOperatorPrecedence(vbDict, op1);
int p2 = GetOperatorPrecedence(vbDict, op2);
return p1.CompareTo(p2);
}
static int GetOperatorPrecedence(Dictionary<BinaryOperatorType, int> dict, BinaryOperatorType op) static int GetOperatorPrecedence(Dictionary<BinaryOperatorType, int> dict, BinaryOperatorType op)
{ {
int p; int p;

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

@ -1159,7 +1159,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.OpenCurlyBrace); outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
} }
foreach (Statement stmt in statements) { foreach (Statement stmt in statements) {
TrackVisit(stmt, null); TrackVisit(stmt, prettyPrintOptions.StatementBraceStyle);
} }
if (statements.Count != 1) { if (statements.Count != 1) {
outputFormatter.PrintToken(Tokens.CloseCurlyBrace); outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
@ -1171,6 +1171,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data) public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data)
{ {
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.Else); outputFormatter.PrintToken(Tokens.Else);
outputFormatter.Space(); outputFormatter.Space();
outputFormatter.PrintToken(Tokens.If); outputFormatter.PrintToken(Tokens.If);

13
src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs

@ -1441,6 +1441,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data) public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data)
{ {
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.ElseIf); outputFormatter.PrintToken(Tokens.ElseIf);
outputFormatter.Space(); outputFormatter.Space();
TrackedVisit(elseIfSection.Condition, data); TrackedVisit(elseIfSection.Condition, data);
@ -2585,26 +2586,32 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
switch (modifier) { switch (modifier) {
case ParameterModifiers.None: case ParameterModifiers.None:
case ParameterModifiers.In: case ParameterModifiers.In:
outputFormatter.PrintToken(Tokens.ByVal); if (prettyPrintOptions.OutputByValModifier) {
outputFormatter.PrintToken(Tokens.ByVal);
outputFormatter.Space();
}
break; break;
case ParameterModifiers.Out: case ParameterModifiers.Out:
Error("Out parameter converted to ByRef", position); //Error("Out parameter converted to ByRef", position);
outputFormatter.PrintToken(Tokens.ByRef); outputFormatter.PrintToken(Tokens.ByRef);
outputFormatter.Space();
break; break;
case ParameterModifiers.Params: case ParameterModifiers.Params:
outputFormatter.PrintToken(Tokens.ParamArray); outputFormatter.PrintToken(Tokens.ParamArray);
outputFormatter.Space();
break; break;
case ParameterModifiers.Ref: case ParameterModifiers.Ref:
outputFormatter.PrintToken(Tokens.ByRef); outputFormatter.PrintToken(Tokens.ByRef);
outputFormatter.Space();
break; break;
case ParameterModifiers.Optional: case ParameterModifiers.Optional:
outputFormatter.PrintToken(Tokens.Optional); outputFormatter.PrintToken(Tokens.Optional);
outputFormatter.Space();
break; break;
default: default:
Error(String.Format("Unsupported modifier : {0}", modifier), position); Error(String.Format("Unsupported modifier : {0}", modifier), position);
break; break;
} }
outputFormatter.Space();
} }
void OutputModifier(Modifiers modifier) void OutputModifier(Modifiers modifier)

7
src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs

@ -14,8 +14,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
/// </summary> /// </summary>
public class VBNetPrettyPrintOptions : AbstractPrettyPrintOptions public class VBNetPrettyPrintOptions : AbstractPrettyPrintOptions
{ {
public VBNetPrettyPrintOptions() /// <summary>
{ /// Gets/Sets if the optional "ByVal" modifier should be written.
} /// </summary>
public bool OutputByValModifier { get; set; }
} }
} }

4
src/Libraries/NRefactory/Test/NRefactoryTests.csproj

@ -143,8 +143,8 @@
<Compile Include="Lexer\CSharp\CustomLexerTests.cs" /> <Compile Include="Lexer\CSharp\CustomLexerTests.cs" />
<Compile Include="Parser\Expressions\DefaultValueExpressionTests.cs" /> <Compile Include="Parser\Expressions\DefaultValueExpressionTests.cs" />
<Compile Include="Output\VBNet\VBNetOutputTest.cs" /> <Compile Include="Output\VBNet\VBNetOutputTest.cs" />
<Compile Include="Output\VBNet\CSharpToVBConverterTest.cs" /> <Compile Include="Output\VBNet\CSharpToVBNetConverterTest.cs" />
<Compile Include="Output\CSharp\VBToCSharpConverterTest.cs" /> <Compile Include="Output\CSharp\VBNetToCSharpConverterTest.cs" />
<Compile Include="Output\SpecialOutputVisitorTest.cs" /> <Compile Include="Output\SpecialOutputVisitorTest.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

152
src/Libraries/NRefactory/Test/Output/CSharp/VBToCSharpConverterTest.cs → src/Libraries/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs

@ -17,7 +17,7 @@ using ICSharpCode.NRefactory.Visitors;
namespace ICSharpCode.NRefactory.Tests.PrettyPrinter namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
[TestFixture] [TestFixture]
public class VBToCSharpConverterTest public class VBNetToCSharpConverterTest
{ {
public void TestProgram(string input, string expectedOutput) public void TestProgram(string input, string expectedOutput)
{ {
@ -27,6 +27,8 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
parser.CompilationUnit.AcceptVisitor(new VBNetConstructsConvertVisitor(), null); parser.CompilationUnit.AcceptVisitor(new VBNetConstructsConvertVisitor(), null);
parser.CompilationUnit.AcceptVisitor(new ToCSharpConvertVisitor(), null); parser.CompilationUnit.AcceptVisitor(new ToCSharpConvertVisitor(), null);
CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor(); CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
outputVisitor.Options.IndentationChar = ' ';
outputVisitor.Options.IndentSize = 2;
outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null); outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
Assert.AreEqual("", outputVisitor.Errors.ErrorOutput); Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
Assert.AreEqual(expectedOutput, outputVisitor.Text); Assert.AreEqual(expectedOutput, outputVisitor.Text);
@ -50,7 +52,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
using (StringReader r = new StringReader(expectedOutput)) { using (StringReader r = new StringReader(expectedOutput)) {
string line; string line;
while ((line = r.ReadLine()) != null) { while ((line = r.ReadLine()) != null) {
b.Append("\t"); b.Append(" ");
b.AppendLine(line); b.AppendLine(line);
} }
} }
@ -63,16 +65,16 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
b.AppendLine("class tmp1"); b.AppendLine("class tmp1");
b.AppendLine("{"); b.AppendLine("{");
b.AppendLine("\tpublic void tmp2()"); b.AppendLine(" public void tmp2()");
b.AppendLine("\t{"); b.AppendLine(" {");
using (StringReader r = new StringReader(expectedOutput)) { using (StringReader r = new StringReader(expectedOutput)) {
string line; string line;
while ((line = r.ReadLine()) != null) { while ((line = r.ReadLine()) != null) {
b.Append("\t\t"); b.Append(" ");
b.AppendLine(line); b.AppendLine(line);
} }
} }
b.AppendLine("\t}"); b.AppendLine(" }");
b.AppendLine("}"); b.AppendLine("}");
TestProgram("Class tmp1 \n Sub tmp2() \n" + input + "\n End Sub \n End Class", b.ToString()); TestProgram("Class tmp1 \n Sub tmp2() \n" + input + "\n End Sub \n End Class", b.ToString());
} }
@ -116,7 +118,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
public void RaiseEvent() public void RaiseEvent()
{ {
TestStatement("RaiseEvent someEvent(Me, EventArgs.Empty)", TestStatement("RaiseEvent someEvent(Me, EventArgs.Empty)",
"if (someEvent != null) {\n\tsomeEvent(this, EventArgs.Empty);\n}"); "if (someEvent != null) {\n someEvent(this, EventArgs.Empty);\n}");
} }
[Test] [Test]
@ -145,42 +147,42 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
public void Property() public void Property()
{ {
TestMember("ReadOnly Property A()\nGet\nReturn Nothing\nEnd Get\nEnd Property", TestMember("ReadOnly Property A()\nGet\nReturn Nothing\nEnd Get\nEnd Property",
"public object A {\n\tget { return null; }\n}"); "public object A {\n get { return null; }\n}");
} }
[Test] [Test]
public void ValueInPropertySetter() public void ValueInPropertySetter()
{ {
TestMember("WriteOnly Property A()\nSet\nDim x As Object = Value\nEnd Set\nEnd Property", TestMember("WriteOnly Property A()\nSet\nDim x As Object = Value\nEnd Set\nEnd Property",
"public object A {\n\tset {\n\t\tobject x = value;\n\t}\n}"); "public object A {\n set {\n object x = value;\n }\n}");
} }
[Test] [Test]
public void ValueInPropertySetter2() public void ValueInPropertySetter2()
{ {
TestMember("WriteOnly Property A()\nSet(ByVal otherName)\nDim x As Object = otherName\nEnd Set\nEnd Property", TestMember("WriteOnly Property A()\nSet(ByVal otherName)\nDim x As Object = otherName\nEnd Set\nEnd Property",
"public object A {\n\tset {\n\t\tobject x = value;\n\t}\n}"); "public object A {\n set {\n object x = value;\n }\n}");
} }
[Test] [Test]
public void AbstractProperty1() public void AbstractProperty1()
{ {
TestMember("Public MustOverride Property Salary() As Decimal", TestMember("Public MustOverride Property Salary() As Decimal",
"public abstract decimal Salary {\n\tget;\n\tset;\n}"); "public abstract decimal Salary {\n get;\n set;\n}");
} }
[Test] [Test]
public void AbstractProperty2() public void AbstractProperty2()
{ {
TestMember("Public ReadOnly MustOverride Property Salary() As Decimal", TestMember("Public ReadOnly MustOverride Property Salary() As Decimal",
"public abstract decimal Salary {\n\tget;\n}"); "public abstract decimal Salary {\n get;\n}");
} }
[Test] [Test]
public void AbstractProperty3() public void AbstractProperty3()
{ {
TestMember("Public WriteOnly MustOverride Property Salary() As Decimal", TestMember("Public WriteOnly MustOverride Property Salary() As Decimal",
"public abstract decimal Salary {\n\tset;\n}"); "public abstract decimal Salary {\n set;\n}");
} }
[Test] [Test]
@ -243,9 +245,9 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
[Test] [Test]
public void Constructor() public void Constructor()
{ {
TestMember("Sub New()\n\tMyBase.New(1)\nEnd Sub", TestMember("Sub New()\n MyBase.New(1)\nEnd Sub",
"public tmp1() : base(1)\n{\n}"); "public tmp1() : base(1)\n{\n}");
TestMember("Public Sub New()\n\tMe.New(1)\nEnd Sub", TestMember("Public Sub New()\n Me.New(1)\nEnd Sub",
"public tmp1() : this(1)\n{\n}"); "public tmp1() : this(1)\n{\n}");
} }
@ -260,16 +262,16 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
public void Destructor() public void Destructor()
{ {
TestMember("Protected Overrides Sub Finalize()\n" + TestMember("Protected Overrides Sub Finalize()\n" +
"\tTry\n" + " Try\n" +
"\t\tDead()\n" + " Dead()\n" +
"\tFinally\n" + " Finally\n" +
"\t\tMyBase.Finalize()\n" + " MyBase.Finalize()\n" +
"\tEnd Try\n" + " End Try\n" +
"End Sub", "End Sub",
"~tmp1()\n" + "~tmp1()\n" +
"{\n" + "{\n" +
"\tDead();\n" + " Dead();\n" +
"}"); "}");
} }
@ -370,8 +372,8 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
TestStatement("Using r1 As New StreamReader(file1), r2 As New StreamReader(file2)\n" + TestStatement("Using r1 As New StreamReader(file1), r2 As New StreamReader(file2)\n" +
"End Using", "End Using",
"using (StreamReader r1 = new StreamReader(file1)) {\n" + "using (StreamReader r1 = new StreamReader(file1)) {\n" +
"\tusing (StreamReader r2 = new StreamReader(file2)) {\n" + " using (StreamReader r2 = new StreamReader(file2)) {\n" +
"\t}\n" + " }\n" +
"}"); "}");
} }
@ -387,20 +389,20 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
i = 9 i = 9
End Select", End Select",
"switch (i) {\n" + "switch (i) {\n" +
"\tcase 0:\n" + " case 0:\n" +
"\tcase 1:\n" + " case 1:\n" +
"\tcase 2:\n" + " case 2:\n" +
"\tcase 3:\n" + " case 3:\n" +
"\tcase 4:\n" + " case 4:\n" +
"\tcase 5:\n" + " case 5:\n" +
"\t\ti = 10;\n" + " i = 10;\n" +
"\t\tbreak;\n" + " break;\n" +
"\tcase 11:\n" + " case 11:\n" +
"\t\ti = 0;\n" + " i = 0;\n" +
"\t\tbreak;\n" + " break;\n" +
"\tdefault:\n" + " default:\n" +
"\t\ti = 9;\n" + " i = 9;\n" +
"\t\tbreak;\n" + " break;\n" +
"}"); "}");
} }
@ -412,7 +414,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"End Function", "End Function",
"public int run(int i)\n" + "public int run(int i)\n" +
"{\n" + "{\n" +
"\treturn 0;\n" + " return 0;\n" +
"}"); "}");
} }
@ -424,7 +426,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"End Function", "End Function",
"public int run(int i)\n" + "public int run(int i)\n" +
"{\n" + "{\n" +
"\treturn 0;\n" + " return 0;\n" +
"}"); "}");
} }
@ -438,11 +440,11 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"End Function", "End Function",
"public int run(int i)\n" + "public int run(int i)\n" +
"{\n" + "{\n" +
"\tint " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = 0;\n" + " int " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = 0;\n" +
"\twhile (something) {\n" + " while (something) {\n" +
"\t\t" + VBNetConstructsConvertVisitor.FunctionReturnValueName + " += i;\n" + " " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " += i;\n" +
"\t}\n" + " }\n" +
"\treturn " + VBNetConstructsConvertVisitor.FunctionReturnValueName + ";\n" + " return " + VBNetConstructsConvertVisitor.FunctionReturnValueName + ";\n" +
"}"); "}");
} }
@ -457,11 +459,11 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"End Function", "End Function",
"public int run(int i)\n" + "public int run(int i)\n" +
"{\n" + "{\n" +
"\tint " + ReturnValueName + " = 0;\n" + " int " + ReturnValueName + " = 0;\n" +
"\twhile (something) {\n" + " while (something) {\n" +
"\t\t" + ReturnValueName + " = " + ReturnValueName + " + run(i - 1);\n" + " " + ReturnValueName + " = " + ReturnValueName + " + run(i - 1);\n" +
"\t}\n" + " }\n" +
"\treturn " + ReturnValueName + ";\n" + " return " + ReturnValueName + ";\n" +
"}"); "}");
} }
@ -475,11 +477,11 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"End Function", "End Function",
"public CustomType run(int i)\n" + "public CustomType run(int i)\n" +
"{\n" + "{\n" +
"\tCustomType " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = default(CustomType);\n" + " CustomType " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = default(CustomType);\n" +
"\twhile (something) {\n" + " while (something) {\n" +
"\t\t" + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = new CustomType();\n" + " " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = new CustomType();\n" +
"\t}\n" + " }\n" +
"\treturn " + VBNetConstructsConvertVisitor.FunctionReturnValueName + ";\n" + " return " + VBNetConstructsConvertVisitor.FunctionReturnValueName + ";\n" +
"}"); "}");
} }
@ -512,7 +514,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
End Sub", End Sub",
@"private void Test() @"private void Test()
{ {
static_Test_j += 1; static_Test_j += 1;
} }
static int static_Test_j = 0;"); static int static_Test_j = 0;");
} }
@ -530,12 +532,12 @@ Private Sub Test2
End Sub", End Sub",
@"private void Test() @"private void Test()
{ {
static_Test_j += 1; static_Test_j += 1;
} }
static int static_Test_j = 0; static int static_Test_j = 0;
private void Test2() private void Test2()
{ {
static_Test2_j += 2; static_Test2_j += 2;
} }
static int static_Test2_j = 0;"); static int static_Test2_j = 0;");
} }
@ -551,9 +553,9 @@ static int static_Test2_j = 0;");
public void WithStatementTest() public void WithStatementTest()
{ {
TestStatement("With Ejes\n" + TestStatement("With Ejes\n" +
"\t.AddLine(p1, p2)\n" + " .AddLine(p1, p2)\n" +
"End With", "End With",
"{\n\tEjes.AddLine(p1, p2);\n}"); "{\n Ejes.AddLine(p1, p2);\n}");
} }
[Test] [Test]
@ -566,7 +568,7 @@ static int static_Test2_j = 0;");
" End With\n" + " End With\n" +
"End With", "End With",
"{\n\t{\n\t\ttb1.Font.Italic = true;\n\t}\n}"); "{\n {\n tb1.Font.Italic = true;\n }\n}");
} }
[Test] [Test]
@ -579,14 +581,14 @@ static int static_Test2_j = 0;");
" End With\n" + " End With\n" +
"End With", "End With",
"{\n\t{\n\t\ttb1.Something.Font.Italic = true;\n\t}\n}"); "{\n {\n tb1.Something.Font.Italic = true;\n }\n}");
} }
[Test] [Test]
public void StructureWithImplicitPublicField() public void StructureWithImplicitPublicField()
{ {
TestMember("Public Structure Example \n Dim x As Object \n End Structure", TestMember("Public Structure Example \n Dim x As Object \n End Structure",
"public struct Example\n{\n\tpublic object x;\n}"); "public struct Example\n{\n public object x;\n}");
} }
[Test] [Test]
@ -607,16 +609,16 @@ static int static_Test2_j = 0;");
public void InterfaceVisibility() public void InterfaceVisibility()
{ {
TestMember("Public Interface ITest\n" + TestMember("Public Interface ITest\n" +
"\tSub Test()\n" + " Sub Test()\n" +
"\tProperty Name As String\n" + " Property Name As String\n" +
"End Interface", "End Interface",
"public interface ITest\n" + "public interface ITest\n" +
"{\n" + "{\n" +
"\tvoid Test();\n" + " void Test();\n" +
"\tstring Name {\n" + " string Name {\n" +
"\t\tget;\n" + " get;\n" +
"\t\tset;\n" + " set;\n" +
"\t}\n" + " }\n" +
"}"); "}");
} }
@ -648,6 +650,18 @@ static int static_Test2_j = 0;");
TestStatement("If \"\" <> a Then Return", "if (!string.IsNullOrEmpty(a)) return; "); TestStatement("If \"\" <> a Then Return", "if (!string.IsNullOrEmpty(a)) return; ");
} }
[Test]
public void ElseIfConversion()
{
TestStatement("If a Then\nElse If b Then\nElse\nEnd If",
"if (a) {\n" +
"}\n" +
"else if (b) {\n" +
"}\n" +
"else {\n" +
"}");
}
[Test] [Test]
public void ArrayCreationUpperBound() public void ArrayCreationUpperBound()
{ {

5
src/Libraries/NRefactory/Test/Output/SpecialOutputVisitorTest.cs

@ -63,7 +63,6 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
List<ISpecial> specials = parser.Lexer.SpecialTracker.RetrieveSpecials(); List<ISpecial> specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
PreprocessingDirective.CSharpToVB(specials); PreprocessingDirective.CSharpToVB(specials);
outputVisitor.Options.IndentationChar = ' '; outputVisitor.Options.IndentationChar = ' ';
outputVisitor.Options.TabSize = 2;
outputVisitor.Options.IndentSize = 2; outputVisitor.Options.IndentSize = 2;
using (SpecialNodesInserter.Install(specials, outputVisitor)) { using (SpecialNodesInserter.Install(specials, outputVisitor)) {
outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null); outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
@ -180,7 +179,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
public void CommentsInsideMethodVB() public void CommentsInsideMethodVB()
{ {
TestProgramVB(@"Public Class Class1 TestProgramVB(@"Public Class Class1
Private Function test(ByVal l As Integer, ByVal lvw As Integer) As Boolean Private Function test(l As Integer, lvw As Integer) As Boolean
' Begin ' Begin
Dim i As Integer = 1 Dim i As Integer = 1
Return False Return False
@ -212,7 +211,7 @@ End Class");
"Class A\n" + "Class A\n" +
" ' comment\n" + " ' comment\n" +
" <PreserveSig()> _\n" + " <PreserveSig()> _\n" +
" Public Sub B(ByVal c As Integer)\n" + " Public Sub B(c As Integer)\n" +
" End Sub\n" + " End Sub\n" +
"End Class"); "End Class");
} }

141
src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs → src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBNetConverterTest.cs

@ -17,7 +17,7 @@ using ICSharpCode.NRefactory.Visitors;
namespace ICSharpCode.NRefactory.Tests.PrettyPrinter namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
[TestFixture] [TestFixture]
public class CSharpToVBConverterTest public class CSharpToVBNetConverterTest
{ {
public void TestProgram(string input, string expectedOutput) public void TestProgram(string input, string expectedOutput)
{ {
@ -27,6 +27,9 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
parser.CompilationUnit.AcceptVisitor(new CSharpConstructsConvertVisitor(), null); parser.CompilationUnit.AcceptVisitor(new CSharpConstructsConvertVisitor(), null);
parser.CompilationUnit.AcceptVisitor(new ToVBNetConvertVisitor(), null); parser.CompilationUnit.AcceptVisitor(new ToVBNetConvertVisitor(), null);
VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor(); VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor();
outputVisitor.Options.IndentationChar = ' ';
outputVisitor.Options.IndentSize = 2;
outputVisitor.Options.OutputByValModifier = true;
outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null); outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
Assert.AreEqual("", outputVisitor.Errors.ErrorOutput); Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
Assert.AreEqual(expectedOutput, outputVisitor.Text); Assert.AreEqual(expectedOutput, outputVisitor.Text);
@ -39,7 +42,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
using (StringReader r = new StringReader(expectedOutput)) { using (StringReader r = new StringReader(expectedOutput)) {
string line; string line;
while ((line = r.ReadLine()) != null) { while ((line = r.ReadLine()) != null) {
b.Append("\t"); b.Append(" ");
b.AppendLine(line); b.AppendLine(line);
} }
} }
@ -51,15 +54,15 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
b.AppendLine("Class tmp1"); b.AppendLine("Class tmp1");
b.AppendLine("\tPrivate Sub tmp2()"); b.AppendLine(" Private Sub tmp2()");
using (StringReader r = new StringReader(expectedOutput)) { using (StringReader r = new StringReader(expectedOutput)) {
string line; string line;
while ((line = r.ReadLine()) != null) { while ((line = r.ReadLine()) != null) {
b.Append("\t\t"); b.Append(" ");
b.AppendLine(line); b.AppendLine(line);
} }
} }
b.AppendLine("\tEnd Sub"); b.AppendLine(" End Sub");
b.AppendLine("End Class"); b.AppendLine("End Class");
TestProgram("class tmp1 { void tmp2() {\n" + input + "\n}}", b.ToString()); TestProgram("class tmp1 { void tmp2() {\n" + input + "\n}}", b.ToString());
} }
@ -78,7 +81,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestProgram("class test : IComparable { }", TestProgram("class test : IComparable { }",
"Class test\r\n" + "Class test\r\n" +
"\tImplements IComparable\r\n" + " Implements IComparable\r\n" +
"End Class\r\n"); "End Class\r\n");
} }
@ -87,7 +90,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestProgram("class test : System.IComparable { }", TestProgram("class test : System.IComparable { }",
"Class test\r\n" + "Class test\r\n" +
"\tImplements System.IComparable\r\n" + " Implements System.IComparable\r\n" +
"End Class\r\n"); "End Class\r\n");
} }
@ -96,7 +99,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestProgram("class test : InvalidDataException { }", TestProgram("class test : InvalidDataException { }",
"Class test\r\n" + "Class test\r\n" +
"\tInherits InvalidDataException\r\n" + " Inherits InvalidDataException\r\n" +
"End Class\r\n"); "End Class\r\n");
} }
@ -105,7 +108,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestProgram("class test : System.IO.InvalidDataException { }", TestProgram("class test : System.IO.InvalidDataException { }",
"Class test\r\n" + "Class test\r\n" +
"\tInherits System.IO.InvalidDataException\r\n" + " Inherits System.IO.InvalidDataException\r\n" +
"End Class\r\n"); "End Class\r\n");
} }
@ -115,8 +118,8 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
TestStatement("for (i = 0; unknownCondition; i++) b[i] = s[i];", TestStatement("for (i = 0; unknownCondition; i++) b[i] = s[i];",
"i = 0\n" + "i = 0\n" +
"While unknownCondition\n" + "While unknownCondition\n" +
"\tb(i) = s(i)\n" + " b(i) = s(i)\n" +
"\ti += 1\n" + " i += 1\n" +
"End While"); "End While");
} }
@ -126,8 +129,8 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
TestStatement("for (i = 0; unknownCondition; i++) { b[i] = s[i]; }", TestStatement("for (i = 0; unknownCondition; i++) { b[i] = s[i]; }",
"i = 0\n" + "i = 0\n" +
"While unknownCondition\n" + "While unknownCondition\n" +
"\tb(i) = s(i)\n" + " b(i) = s(i)\n" +
"\ti += 1\n" + " i += 1\n" +
"End While"); "End While");
} }
@ -136,7 +139,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestStatement("for (i = 0; i < end; i++) b[i] = s[i];", TestStatement("for (i = 0; i < end; i++) b[i] = s[i];",
"For i = 0 To [end] - 1\n" + "For i = 0 To [end] - 1\n" +
"\tb(i) = s(i)\n" + " b(i) = s(i)\n" +
"Next"); "Next");
} }
[Test] [Test]
@ -144,7 +147,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestStatement("for (i = 0; i < end; i++) { b[i] = s[i]; }", TestStatement("for (i = 0; i < end; i++) { b[i] = s[i]; }",
"For i = 0 To [end] - 1\n" + "For i = 0 To [end] - 1\n" +
"\tb(i) = s(i)\n" + " b(i) = s(i)\n" +
"Next"); "Next");
} }
@ -170,28 +173,38 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestStatement("if (FullImage != null) DrawImage();", TestStatement("if (FullImage != null) DrawImage();",
"If FullImage IsNot Nothing Then\n" + "If FullImage IsNot Nothing Then\n" +
"\tDrawImage()\n" + " DrawImage()\n" +
"End If"); "End If");
// regression test: // regression test:
TestStatement("if (FullImage != null) e.DrawImage();", TestStatement("if (FullImage != null) e.DrawImage();",
"If FullImage IsNot Nothing Then\n" + "If FullImage IsNot Nothing Then\n" +
"\te.DrawImage()\n" + " e.DrawImage()\n" +
"End If"); "End If");
// with braces: // with braces:
TestStatement("if (FullImage != null) { DrawImage(); }", TestStatement("if (FullImage != null) { DrawImage(); }",
"If FullImage IsNot Nothing Then\n" + "If FullImage IsNot Nothing Then\n" +
"\tDrawImage()\n" + " DrawImage()\n" +
"End If"); "End If");
TestStatement("if (FullImage != null) { e.DrawImage(); }", TestStatement("if (FullImage != null) { e.DrawImage(); }",
"If FullImage IsNot Nothing Then\n" + "If FullImage IsNot Nothing Then\n" +
"\te.DrawImage()\n" + " e.DrawImage()\n" +
"End If"); "End If");
// another bug related to the IfStatement code: // another bug related to the IfStatement code:
TestStatement("if (Tiles != null) foreach (Tile t in Tiles) this.TileTray.Controls.Remove(t);", TestStatement("if (Tiles != null) foreach (Tile t in Tiles) this.TileTray.Controls.Remove(t);",
"If Tiles IsNot Nothing Then\n" + "If Tiles IsNot Nothing Then\n" +
"\tFor Each t As Tile In Tiles\n" + " For Each t As Tile In Tiles\n" +
"\t\tMe.TileTray.Controls.Remove(t)\n" + " Me.TileTray.Controls.Remove(t)\n" +
"\tNext\n" + " Next\n" +
"End If");
}
[Test]
public void ElseIfStatement()
{
TestStatement("if (a) {} else if (b) {} else {}",
"If a Then\n" +
"ElseIf b Then\n" +
"Else\n" +
"End If"); "End If");
} }
@ -200,7 +213,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestMember("void A() { Converter<int, int> i = delegate(int argument) { return argument * 2; }; }", TestMember("void A() { Converter<int, int> i = delegate(int argument) { return argument * 2; }; }",
"Private Sub A()\n" + "Private Sub A()\n" +
"\tDim i As Converter(Of Integer, Integer) = Function(ByVal argument As Integer) argument * 2\n" + " Dim i As Converter(Of Integer, Integer) = Function(ByVal argument As Integer) argument * 2\n" +
"End Sub"); "End Sub");
} }
@ -241,9 +254,9 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
public void Constructor() public void Constructor()
{ {
TestMember("public tmp1() : base(1) { }", TestMember("public tmp1() : base(1) { }",
"Public Sub New()\n\tMyBase.New(1)\nEnd Sub"); "Public Sub New()\n MyBase.New(1)\nEnd Sub");
TestMember("public tmp1() : this(1) { }", TestMember("public tmp1() : this(1) { }",
"Public Sub New()\n\tMe.New(1)\nEnd Sub"); "Public Sub New()\n Me.New(1)\nEnd Sub");
} }
[Test] [Test]
@ -258,11 +271,11 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestMember("~tmp1() { Dead(); }", TestMember("~tmp1() { Dead(); }",
"Protected Overrides Sub Finalize()\n" + "Protected Overrides Sub Finalize()\n" +
"\tTry\n" + " Try\n" +
"\t\tDead()\n" + " Dead()\n" +
"\tFinally\n" + " Finally\n" +
"\t\tMyBase.Finalize()\n" + " MyBase.Finalize()\n" +
"\tEnd Try\n" + " End Try\n" +
"End Sub"); "End Sub");
} }
@ -271,9 +284,9 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestMember("public CategoryInfo this[int index] { get { return List[index] as CategoryInfo; } }", TestMember("public CategoryInfo this[int index] { get { return List[index] as CategoryInfo; } }",
"Public Default ReadOnly Property Item(ByVal index As Integer) As CategoryInfo\n" + "Public Default ReadOnly Property Item(ByVal index As Integer) As CategoryInfo\n" +
"\tGet\n" + " Get\n" +
"\t\tReturn TryCast(List(index), CategoryInfo)\n" + " Return TryCast(List(index), CategoryInfo)\n" +
"\tEnd Get\n" + " End Get\n" +
"End Property"); "End Property");
} }
@ -288,21 +301,21 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"Private m_count As Integer\n" + "Private m_count As Integer\n" +
"Public ReadOnly Property Count() As Integer\n" + "Public ReadOnly Property Count() As Integer\n" +
"\tGet\n" + " Get\n" +
"\t\tReturn m_count\n" + " Return m_count\n" +
"\tEnd Get\n" + " End Get\n" +
"End Property\n" + "End Property\n" +
"Private Sub Test1(ByVal count As Integer)\n" + "Private Sub Test1(ByVal count As Integer)\n" +
"\tcount = 3\n" + " count = 3\n" +
"End Sub\n" + "End Sub\n" +
"Private Sub Test2()\n" + "Private Sub Test2()\n" +
"\tDim count As Integer\n" + " Dim count As Integer\n" +
"\tcount = 3\n" + " count = 3\n" +
"End Sub\n" + "End Sub\n" +
"Private Sub Test3()\n" + "Private Sub Test3()\n" +
"\tFor Each count As Integer In someList\n" + " For Each count As Integer In someList\n" +
"\t\tcount = 3\n" + " count = 3\n" +
"\tNext\n" + " Next\n" +
"End Sub"); "End Sub");
} }
@ -325,7 +338,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestStatement("while (cond) example();", TestStatement("while (cond) example();",
"While cond\n" + "While cond\n" +
"\texample()\n" + " example()\n" +
"End While"); "End While");
} }
@ -340,7 +353,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestStatement("while (test != null) { break; }", TestStatement("while (test != null) { break; }",
"While test IsNot Nothing\n" + "While test IsNot Nothing\n" +
"\tExit While\n" + " Exit While\n" +
"End While"); "End While");
} }
@ -349,7 +362,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestStatement("do { break; } while (test != null);", TestStatement("do { break; } while (test != null);",
"Do\n" + "Do\n" +
"\tExit Do\n" + " Exit Do\n" +
"Loop While test IsNot Nothing"); "Loop While test IsNot Nothing");
} }
@ -358,7 +371,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestMember("public struct A { int field; }", TestMember("public struct A { int field; }",
"Public Structure A\n" + "Public Structure A\n" +
"\tPrivate field As Integer\n" + " Private field As Integer\n" +
"End Structure"); "End Structure");
} }
@ -385,8 +398,8 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
" string Name { get; set; }\n" + " string Name { get; set; }\n" +
"}", "}",
"Public Interface ITest\n" + "Public Interface ITest\n" +
"\tSub Test()\n" + " Sub Test()\n" +
"\tProperty Name() As String\n" + " Property Name() As String\n" +
"End Interface"); "End Interface");
} }
@ -406,8 +419,8 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
public void StaticClass() public void StaticClass()
{ {
TestProgram("public static class Test {}", @"Public NotInheritable Class Test TestProgram("public static class Test {}", @"Public NotInheritable Class Test
Private Sub New() Private Sub New()
End Sub End Sub
End Class End Class
"); ");
} }
@ -429,8 +442,8 @@ End Class
{ {
TestMember("void T(int v) { int V = v; M(V, v); }", TestMember("void T(int v) { int V = v; M(V, v); }",
"Private Sub T(ByVal v__1 As Integer)\n" + "Private Sub T(ByVal v__1 As Integer)\n" +
"\tDim V__2 As Integer = v__1\n" + " Dim V__2 As Integer = v__1\n" +
"\tM(V__2, v__1)\n" + " M(V__2, v__1)\n" +
"End Sub"); "End Sub");
} }
@ -488,16 +501,16 @@ End Class
{ {
TestProgram(@"public class Convert { void Run(string s) { char c; if ((c = s[0]) == '\n') { c = ' '; } } }", TestProgram(@"public class Convert { void Run(string s) { char c; if ((c = s[0]) == '\n') { c = ' '; } } }",
@"Public Class Convert @"Public Class Convert
Private Sub Run(ByVal s As String) Private Sub Run(ByVal s As String)
Dim c As Char Dim c As Char
If (InlineAssignHelper(c, s(0))) = Chr(10) Then If (InlineAssignHelper(c, s(0))) = Chr(10) Then
c = "" ""C c = "" ""C
End If End If
End Sub End Sub
Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, ByVal value As T) As T Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, ByVal value As T) As T
target = value target = value
Return value Return value
End Function End Function
End Class End Class
"); ");
} }
@ -507,10 +520,10 @@ End Class
{ {
TestStatement("{ int a; } { string a; }", TestStatement("{ int a; } { string a; }",
"If True Then\n" + "If True Then\n" +
"\tDim a As Integer\n" + " Dim a As Integer\n" +
"End If\n" + "End If\n" +
"If True Then\n" + "If True Then\n" +
"\tDim a As String\n" + " Dim a As String\n" +
"End If"); "End If");
} }
} }

1
src/Libraries/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs

@ -23,6 +23,7 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
parser.Parse(); parser.Parse();
Assert.AreEqual("", parser.Errors.ErrorOutput); Assert.AreEqual("", parser.Errors.ErrorOutput);
VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor(); VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor();
outputVisitor.Options.OutputByValModifier = true;
outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null); outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
Assert.AreEqual("", outputVisitor.Errors.ErrorOutput); Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
Assert.AreEqual(StripWhitespace(program), StripWhitespace(outputVisitor.Text)); Assert.AreEqual(StripWhitespace(program), StripWhitespace(outputVisitor.Text));

2
src/Main/Base/Project/Src/Project/AbstractProject.cs

@ -114,7 +114,7 @@ namespace ICSharpCode.SharpDevelop.Project
} }
set { set {
WorkbenchSingleton.AssertMainThread(); WorkbenchSingleton.AssertMainThread();
Debug.Assert(Path.IsPathRooted(value)); Debug.Assert(FileUtility.IsUrl(value) || Path.IsPathRooted(value));
lock (SyncRoot) { // locking still required for Directory lock (SyncRoot) { // locking still required for Directory
fileName = value; fileName = value;

7
src/Main/Base/Project/Src/Project/MSBuildEngine.cs

@ -162,12 +162,13 @@ namespace ICSharpCode.SharpDevelop.Project
{ {
try { try {
PrepareBuild(); PrepareBuild();
if (MSBuildEngine.isRunning) {
StartWorkerBuild();
}
} catch (Exception ex) { } catch (Exception ex) {
MessageService.ShowError(ex); MessageService.ShowError(ex);
} }
if (MSBuildEngine.isRunning) {
StartWorkerBuild();
}
} }
void Finish() void Finish()

20
src/Main/Base/Test/CodeConverterTests.cs

@ -216,7 +216,7 @@ namespace ICSharpCode.SharpDevelop.Tests
" Private Function M() As Object\n" + " Private Function M() As Object\n" +
" Return New MatchEvaluator(AddressOf X)\n" + " Return New MatchEvaluator(AddressOf X)\n" +
" End Function\n" + " End Function\n" +
" Private Function X(ByVal match As Match) As String\n" + " Private Function X(match As Match) As String\n" +
" End Function\n" + " End Function\n" +
"End Class"); "End Class");
} }
@ -234,10 +234,10 @@ namespace ICSharpCode.SharpDevelop.Tests
"Imports System\n" + "Imports System\n" +
"Imports System.Text.RegularExpressions\n" + "Imports System.Text.RegularExpressions\n" +
"Class Test\n" + "Class Test\n" +
" Private Sub M(ByVal regex As Regex, ByVal text As String)\n" + " Private Sub M(regex As Regex, text As String)\n" +
" regex.Replace(text, AddressOf X)\n" + " regex.Replace(text, AddressOf X)\n" +
" End Sub\n" + " End Sub\n" +
" Private Function X(ByVal match As Match) As String\n" + " Private Function X(match As Match) As String\n" +
" End Function\n" + " End Function\n" +
"End Class"); "End Class");
} }
@ -600,9 +600,9 @@ namespace ICSharpCode.SharpDevelop.Tests
"Imports System\n" + "Imports System\n" +
"Class Test\n" + "Class Test\n" +
" Implements IServiceProvider\n" + " Implements IServiceProvider\n" +
" Public Function GetService(ByVal a As IntPtr) As Object\n" + " Public Function GetService(a As IntPtr) As Object\n" +
" End Function\n" + " End Function\n" +
" Public Function GetService(ByVal a As Type) As Object Implements IServiceProvider.GetService\n" + " Public Function GetService(a As Type) As Object Implements IServiceProvider.GetService\n" +
" End Function\n" + " End Function\n" +
"End Class"); "End Class");
} }
@ -683,19 +683,19 @@ namespace ICSharpCode.SharpDevelop.Tests
"}", "}",
"Imports System\n" + "Imports System\n" +
"Interface IObj\n" + "Interface IObj\n" +
" Sub T(ByVal a As Object)\n" + " Sub T(a As Object)\n" +
"End Interface\n" + "End Interface\n" +
"Interface IStr\n" + "Interface IStr\n" +
" Sub T(ByVal a As String)\n" + " Sub T(a As String)\n" +
"End Interface\n" + "End Interface\n" +
"Class Test\n" + "Class Test\n" +
" Implements IObj\n" + " Implements IObj\n" +
" Implements IStr\n" + " Implements IStr\n" +
" Public Sub T(ByVal a As String) Implements IStr.T\n" + " Public Sub T(a As String) Implements IStr.T\n" +
" End Sub\n" + " End Sub\n" +
" Public Sub T(ByVal a As Integer)\n" + " Public Sub T(a As Integer)\n" +
" End Sub\n" + " End Sub\n" +
" Public Sub T(ByVal a As Object) Implements IObj.T\n" + " Public Sub T(a As Object) Implements IObj.T\n" +
" End Sub\n" + " End Sub\n" +
"End Class"); "End Class");
} }

Loading…
Cancel
Save