[code-reflection] RFR: Unify code that generates code model of switch statement and expression [v2]

Paul Sandoz psandoz at openjdk.org
Wed Sep 4 17:05:36 UTC 2024


On Wed, 4 Sep 2024 03:50:08 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Unify code that generates code model of switch statement and expression
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Refactor

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ReflectMethods.java line 1522:

> 1520:             if (tree instanceof JCTree.JCSwitch sw) {
> 1521:                 selector = sw.selector;
> 1522:                 cases = sw.cases;

Pass these in as arguments, then you can pass the selector to visitCaseLabel.

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ReflectMethods.java line 1695:

> 1693:                 Type switchType = adaptBottom(tree.type);
> 1694:                 caseBodyType = FunctionType.functionType(typeToTypeElement(switchType));
> 1695:                 yieldType = adaptBottom(tree.type);

Are we not already passing the FunctionType to visitSwitchStatAndExpr? So the only difference would be the yieldType.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/220#discussion_r1744137542
PR Review Comment: https://git.openjdk.org/babylon/pull/220#discussion_r1744139436


More information about the babylon-dev mailing list