Open aravij opened 4 years ago
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:
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.
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.
To provide seamless functionality with
JavalangImproved
we need to be able to provide all method statements grouped by scope.