https://kotlinlang.org logo
#compiler
Title
# compiler
t

Tracey Yoshima

07/19/2023, 4:29 AM
👋 I figure it is unlikely, since it’s unnecessary for the compiler, but I was wondering if there is a setting in the compiler that will preserve the original PSI from the source code in the FIR? Or are there any utilities I could use to return modifiers and annotations on. FirElement in source code order?
d

dmitriy.novozhilov

07/19/2023, 7:09 AM
The compiler saves original syntax tree in FIR elements in
FirElement.source
property By default compiler does not use PSI during CLI compilation, but you can force it to do it with
-Xuse-fir-lt=false
flag
t

Tracey Yoshima

07/19/2023, 2:45 PM
Great, I’ll check that option out. From what I observed the PSI that is stored in the FirElement.source is changed (CR in CRLF is removed, unnecessary parens are removed, etc.), I’ll check out the flag, thank you!