You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you get an IOperation node, there are scenarios where, due to things like invalid syntax, there are child syntax nodes with valid IOperations that you cannot get to from the parent node. As an example, take this (invalid) C# code:
In syntax, we're able to get to the invalid ArrayRankSpecifier, even though such a construct shouldn't exist. If we get the IOperation for the VariableDeclaration`, we get the following tree:
IOperation tree for "int[1, 2] x"
IVariableDeclarationStatement (1 variables) (OperationKind.VariableDeclarationStatement)
IVariableDeclaration: System.Int32[,] x (OperationKind.VariableDeclaration)
Here, there is no indication that there are other nodes below the IVariableDeclaration's type. We can retrieve those IOperations, however, by getting the IOperation for the NumericLiterals that make up the array rank specifier. To deal with this, we'll likely have to expose some kind of general Children attribute, where we can put all of these invalid nodes that otherwise don't have a place to be exposed. Related to #17802.
The text was updated successfully, but these errors were encountered:
This is a very corner case scenario. Unless we see more instances of this kind, the decision was that we should not be able to get to the Ioperations of this. We should essentially hide them and return null.
When you get an IOperation node, there are scenarios where, due to things like invalid syntax, there are child syntax nodes with valid IOperations that you cannot get to from the parent node. As an example, take this (invalid) C# code:
This produces the following syntax tree:
In syntax, we're able to get to the invalid
ArrayRankSpecifier
, even though such a construct shouldn't exist. If we get theIOperation for the
VariableDeclaration`, we get the following tree:Here, there is no indication that there are other nodes below the
IVariableDeclaration
's type. We can retrieve those IOperations, however, by getting the IOperation for theNumericLiteral
s that make up the array rank specifier. To deal with this, we'll likely have to expose some kind of general Children attribute, where we can put all of these invalid nodes that otherwise don't have a place to be exposed. Related to #17802.The text was updated successfully, but these errors were encountered: