-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[IOperation] Differing variable declaration in Blocks loops between C# and VB #17998
Comments
@dotnet/analyzer-ioperation |
This issue also affects If Then Else loops as well. FYI @jinujoseph |
VB statement/block handling has always been a bit baroque. We'll likely want to make an decision here across all VB statements. I view that as orthogonal to any other issues we find with individual elements. |
Design Decision: For now, let's keep things similar between the languages. We'll only support getting the Operation on the VB block, and not on hte header statement. |
This should be fixed by whoever works on these constructs. Any declared variables should show up in the operation tree somehow. |
this should be fixed as per our new design forloops |
C# Code:
Resulting IOp Tree:
Visual Basic code:
Resulting IOp Tree:
There are a few differences here.
IVariableDeclaration(Statement)
in VB. In fact, there doesn't appear to be any variable declarations in the accessibleIOperation
statements for VB.IForLoopStatement
. Both languages have, syntax-wise, aForStatement
construct. In C#, this refers to the entire block. In VB, this refers just to theFor i As Integer = 1 To 5
section, and is enclosed by aForBlock
construct. You can't get access to theIForLoopStatement
from theForStatement
, only theForBlock
. While I can understand the difference between the languages here, perhaps we should allow getting theIForLoopStatement
from theForStatement
in VB.The text was updated successfully, but these errors were encountered: