Browse Source

Fixed forum-8290: Do not add "static" to constants when converting a VB module to a C# class.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3476 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
690d353d37
  1. 3
      src/Libraries/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs
  2. 10
      src/Libraries/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs

3
src/Libraries/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs

@ -37,7 +37,8 @@ namespace ICSharpCode.NRefactory.Visitors
} }
FieldDeclaration fd = node as FieldDeclaration; FieldDeclaration fd = node as FieldDeclaration;
if (fd != null) { if (fd != null) {
fd.Modifier |= Modifiers.Static; if ((fd.Modifier & Modifiers.Const) == 0)
fd.Modifier |= Modifiers.Static;
} }
} }
} }

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

@ -691,5 +691,15 @@ static int static_Test2_j = 0;");
{ {
TestStatement("For Me.Field = 1 To 10 : Next Me.Field", "for (this.Field = 1; this.Field <= 10; this.Field++) {\n}"); TestStatement("For Me.Field = 1 To 10 : Next Me.Field", "for (this.Field = 1; this.Field <= 10; this.Field++) {\n}");
} }
[Test]
public void ConstModuleMember()
{
TestProgram("Module Test : Public Const C As Integer = 0 : End Module",
"static class Test\r\n" +
"{\r\n" +
" public const int C = 0;\r\n" +
"}");
}
} }
} }

Loading…
Cancel
Save