[code-reflection] RFR: Clearly mark which AST nodes are unsupported in ReflectMethods

Paul Sandoz psandoz at openjdk.org
Mon May 27 15:40:10 UTC 2024


On Mon, 27 May 2024 11:56:40 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> The logic in `ReflectMethods` uses a `FilterScanner` to scan the body of methods and turn them into code models.
> A filter scanner is a scanner that only supports a subset of all AST nodes (and throws when it encounter AST nodes not in that set).
> 
> Having a list of supported nodes isn't as useful in this context as having a list of unsupported ones. After all, unsupported node cause the compiler to bark when generating code models. As such, implementation effort should be focussed on reducing the set of unsupported nodes to (eventually) zero.
> 
> For this reason, this PR applies a simple change where we first list the set of unsupported nodes, and then we compute their complement, and use that complement to set the `FilterScanner` constructor parameter.
> 
> The list of unsupported nodes is organised in two sections:
> * first we have a list of all unsupported nodes that likely would benefit from more support
> * then we have a list of all unsupported nodes which will likely never be supported, either because they are already handled as part of an enclosing statement (e.g. `case` AST nodes), or because they are no longer relevant for `ReflectMethods` (e.g. `TYPEAPPLY`).
> 
> This should hopefully make it clear where implementation efforts should be directed to.

Good change. It's quite encouraging to see the progress. If you merge with the tip the set will reduce further :-)

What we should eventually end up with is the set of nodes we should never directly encounter in the visitor. The most relevant subset will be the pattern nodes, which we check the support of more explicitly in method `scanPattern`.

-------------

PR Review: https://git.openjdk.org/babylon/pull/97#pullrequestreview-2081169034


More information about the babylon-dev mailing list