On Thu, 27 Apr 2023 14:53:21 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> Jim Laskey has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   PreviewFeatures.isEnabled()
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java line 432:
> 
>> 430: 
>> 431:     // Restructure top level to be an top level anonymous class.
>> 432:     public static void constructAnonymousMainClass(JCCompilationUnit 
>> tree,
> 
> Question: any reason as to why this is done here and not in the parser? 
> Typically we don't want to do tree transformation at parse time, as that 
> messes up clients that want to access the "non-desugared" tree (such as IDE) 
> and expect some mapping between source to AST. But if you do the rewriting in 
> Enter, not much changes, that is, clients such as IDEs would still see 
> something that doesn't resemble the source.

The source file name is not available until after parsing.

> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/VirtualParser.java 
> line 191:
> 
>> 189:      * @param <E> return type of parserAction
>> 190:      */
>> 191:     public static <E> Optional<E> speculativeParse(JavacParser parser,
> 
> Since this is never use, and because of the TODO - should we just drop it for 
> the time being?

dropping

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1179543180
PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1179534229

Reply via email to