Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VB -> C#: Add/remove parenthesis #265

Closed
mrmonday opened this Issue Apr 5, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@mrmonday
Copy link
Contributor

mrmonday commented Apr 5, 2019

Input code

Public Class Class1
    Sub Foo()
        Dim x = Bar
    End Sub

    Function Bar() As Integer
        Return 1
    End Function
End Class

Erroneous output

public class Class1
{
    public void Foo()
    {
        var x = Bar;
    }

    public int Bar()
    {
        return 1;
    }
}

Expected output

public class Class1
{
    public void Foo()
    {
        var x = Bar();
    }

    public int Bar()
    {
        return 1;
    }
}

Details

Product in use: VS extension

Version in use: 6.6.0

In VB, parenthesis are optional for method calls - they need to be added when converting to C#.

The reverse is also true - VB allows parenthesis for properties, where C# doesn't.

@GrahamTheCoder

This comment has been minimized.

Copy link
Member

GrahamTheCoder commented Apr 8, 2019

I'm surprised to see it fail in such a simple case, I seem to remember there's some code for dealing with it when it's parsed as an empty argument list. Perhaps it's coming out as a different syntax structure.

I was not aware property calls could have parentheses so that's unlikely to be covered anywhere so far.

mrmonday added a commit to mrmonday/CodeConverter that referenced this issue Apr 17, 2019

@mrmonday mrmonday referenced this issue Apr 17, 2019

Merged

Add/remove parenthesis as required for VB -> C# #284

2 of 2 tasks complete

GrahamTheCoder added a commit to mrmonday/CodeConverter that referenced this issue Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.