Closed elGuille-info closed 3 years ago
I "forked" your project and make this change.
@elGuille-info do a PR and I will merge. I don't use List I use SyntaxList. Also if you do a PR add your tests as well.
@elGuille-info I simplified it and merged thanks
Dim modifiers As List(Of SyntaxToken)
If methodNameToken.ValueText = "Main" AndAlso
node.Modifiers.Count = 1 AndAlso
node.Modifiers(0).IsKind(CS.SyntaxKind.StaticKeyword) Then
If Me.IsModule Then
modifiers = PublicModifier.ToList
Else
modifiers = PublicModifier.ToList
modifiers.AddRange(ConvertModifiers(node.Modifiers, Me.IsModule, If(containingType?.IsInterfaceType() = True, TokenContext.Local, TokenContext.Member)).ToList)
'modifiers.Remove(PrivateKeyword)
Dim index As Integer = modifiers.IndexOf(VB.SyntaxKind.PrivateKeyword)
If index > -1 Then
modifiers.RemoveAt(index)
End If
End If
Else
modifiers = ConvertModifiers(node.Modifiers, Me.IsModule, If(containingType?.IsInterfaceType() = True, TokenContext.Local, TokenContext.Member)).ToList
End If
Closed in New in 5.0.0.17/5.0.0.8 Thanks @elGuille-info
Your code:
I changed to this and works in all the test I made: Declaring the class static or not.
The only thing is that Remove seems not to work on the List(Of SyntaxToken) and I use a simple for/netxt (and works!)
File: CSharpToVB\CodeConverter\CSharpToVBVisitors\DeclarationVisitor.vb
Guillermo