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

[IOperation] Hidden sub nodes #18351

Closed
333fred opened this issue Mar 31, 2017 · 3 comments
Closed

[IOperation] Hidden sub nodes #18351

333fred opened this issue Mar 31, 2017 · 3 comments

Comments

@333fred
Copy link
Member

333fred commented Mar 31, 2017

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:

class Program
{
    static void Main(string[] args)
    {
        int[1, 2] x;
    }
}

This produces the following syntax tree:

image

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.

@333fred 333fred added Area-Analyzers Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature - IOperation IOperation labels Mar 31, 2017
@jinujoseph
Copy link
Contributor

jinujoseph commented Apr 11, 2017

Design Team Decision

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.

@jinujoseph jinujoseph added this to the 15.3 milestone Apr 11, 2017
@jinujoseph jinujoseph modified the milestones: 15.later, 15.3 Apr 18, 2017
@jinujoseph jinujoseph removed the Concept-API This issue involves adding, removing, clarification, or modification of an API. label Apr 18, 2017
@jinujoseph jinujoseph modified the milestones: Unknown, 15.later May 2, 2017
@jinujoseph jinujoseph modified the milestones: Unknown, 15.8 Jun 23, 2018
@jinujoseph
Copy link
Contributor

This should be fixed now.
pls verify and close

@333fred
Copy link
Member Author

333fred commented Jun 25, 2018

With the changes to the way that GetOperation works, it's no longer possible to retrieve those individual IOperations, as per design decision.

@333fred 333fred closed this as completed Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants