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

Copmuted field 'statements_by_scope' #570

Open
aravij opened this issue Jul 25, 2020 · 2 comments · Fixed by #607
Open

Copmuted field 'statements_by_scope' #570

aravij opened this issue Jul 25, 2020 · 2 comments · Fixed by #607
Assignees
Labels
enhancement New feature or request
Projects
Milestone

Comments

@aravij
Copy link
Contributor

aravij commented Jul 25, 2020

To provide seamless functionality with JavalangImproved we need to be able to provide all method statements grouped by scope.

@aravij aravij added the enhancement New feature or request label Jul 25, 2020
@aravij aravij added this to the AST framework milestone Jul 25, 2020
@aravij aravij self-assigned this Jul 25, 2020
@aravij aravij added this to To do in Aibolit via automation Jul 25, 2020
@aravij
Copy link
Contributor Author

aravij commented Aug 5, 2020

At this point it is quite hard to create such functionality as computed field, because some scopes (like lambdas) may be inside expressions. To be able to search inside expression, we need on of this:

  • decompose expression to atoms (literals, variables and lambdas)
  • use DFS

First option is seamed to me right, but quite expensive. Second cannot be done without retrieving AST, which, unfortunately, not possible with computed fields, as they only based on ASTNode.

Assuming this, I decided to create a ScopesGraph as a separate class, which is built by accepting method ast. So it is now can use all AST functionality and find lambdas (and anonymous classes) with help of DFS.

aravij added a commit that referenced this issue Aug 8, 2020
aravij added a commit that referenced this issue Aug 8, 2020
@aravij aravij linked a pull request Aug 8, 2020 that will close this issue
@aravij aravij mentioned this issue Aug 8, 2020
aravij added a commit that referenced this issue Aug 8, 2020
@rultor rultor closed this as completed in 0dc550f Aug 8, 2020
Aibolit automation moved this from To do to Done Aug 8, 2020
@aravij
Copy link
Contributor Author

aravij commented Aug 17, 2020

Currently scope graph does not provide all the needed information. To correct it the concept of the graph have to be changed. Now graph vertexes should either represent scope or statement. Graph becomes bipartite. Edges go from scope to statement is that statement is contained in that scope. Edges from statement goes to scope if it is created by that statement.

@aravij aravij reopened this Aug 17, 2020
Aibolit automation moved this from Done to In progress Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Aibolit
  
In progress
Development

Successfully merging a pull request may close this issue.

1 participant