[code-reflection] RFR: Remove the code model transformation: addVarsWhenNecessary.
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Apr 8 16:14:40 UTC 2025
On Tue, 8 Apr 2025 15:58:24 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:
> We remove the code model transformation: `addVarsWhenNecessary`.
src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/CodeModelToAST.java line 30:
> 28: private final Map<JavaType, Type> jtToType;
> 29: private Symbol.MethodSymbol ms;
> 30: private int c = 0; // used to name variables we introduce in the AST
please rename to `localVarCount` or something like that
src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/CodeModelToAST.java line 198:
> 196: default -> throw new IllegalStateException("Op -> JCTree not supported for :" + op.getClass().getName());
> 197: };
> 198: if (tree instanceof JCTree.JCExpression expr) {
When we get here, in my mind there's only two cases:
* `tree` is an expression -- in which case we treat the expression as the initializer of some synthetic variable that we create
* `tree` is a `return` node -- in which case there's nothing to do -- e.g. no need to call `map` !
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/387#discussion_r2033554346
PR Review Comment: https://git.openjdk.org/babylon/pull/387#discussion_r2033552583
More information about the babylon-dev
mailing list