dotnet/roslyn

VB: No compiler API to get built in-operator of AssignmentStatement

Open

#6.366 geöffnet am 27. Okt. 2015

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-CompilersConcept-APIFeature Requesthelp wanted

Repository-Metriken

Stars
 (20.414 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

While we can use GetSymbolInfo to retrieve the built-in operator used in an expression, we currently lack an API to retrieve the built-in operator used in a VB assignment statement. This results in analysis problems like the one causing #2560. Additionally, VB IDE features work inconsistently because built-in operators can't always be retrieved from the compiler APIs.

Module Program
    Sub Main()
        Dim x As Integer
        x = x + 1
        x += 1
    End Sub
End Module

In the code above, if the user hovers over + in the first assignment statement, they'll see the built-in operator in the Quick Info tooltip:

image

However, there's no tooltip if they hover over +=.

This is in contrast to C#. In C#, because assignments are expressions, GetSymbolInfo can return the built-in operator for each case:

image

image

Contributor Guide