py
08/04/2025, 12:40 PMfun somewhere() {
log("foo")
}
would compile down to:
fun somewhere() {
log("somewhere()", "foo")
}
or
fun somewhere() {
log("Somewhere.kt", "foo")
}
From what I can tell, it looks like I need to write "backend" plugin, as this is modifying bytecode? Correct me if wrong plz. I found this recent example: https://github.com/thalesdev/first-kotlin-compiler-plugin to get started with a kotlin compiler plugin. So now I'm trying to figure out how to learn the details of the compiler related data structures, what I need to read, the transformations to do.. would love pointers there, recent examples, etc.
I'm not even sure this is the right channel to ask this question in, plz redirect me as neededpy
08/04/2025, 12:45 PMmbonnin
08/04/2025, 12:48 PMmbonnin
08/04/2025, 12:50 PMkevin.cianfarini
08/04/2025, 12:52 PMmbonnin
08/04/2025, 12:53 PMIr transformation more than Fir.mbonnin
08/04/2025, 12:53 PMcite is probably even closer to the use case hereJavier
08/04/2025, 1:07 PMJavier
08/04/2025, 1:08 PMJavier
08/04/2025, 1:09 PMpy
08/04/2025, 1:10 PMpy
08/04/2025, 1:10 PMJavier
08/04/2025, 1:11 PMpy
08/04/2025, 1:11 PMJavier
08/04/2025, 1:17 PMJavier
08/04/2025, 1:23 PM@Mokoki
@PublishedApi
internal fun internalLog(
priority: Priority? = null,
tag: String? = null,
kType: KType,
fileLink: String,
fileName: String,
classExhaustiveKind: String,
className: String,
functionName: String,
lineNumber: Int,
message: () -> String,
) {
...
}
So, if I remember correctly, I was replacing the original log call with that internal call, passing all the necessary parameters so they can be shown in the terminalJavier
08/04/2025, 1:24 PMpy
08/04/2025, 1:44 PMpy
08/04/2025, 1:44 PMpy
08/04/2025, 1:45 PMpy
08/04/2025, 1:46 PMJavier
08/04/2025, 2:13 PMpy
08/04/2025, 3:49 PM__FILE__py
08/04/2025, 3:49 PMJavier
08/04/2025, 3:53 PM__FILE__ directly, what would happens if it is used in a default argument? Original function, or call site? 🤔py
08/04/2025, 3:54 PMpy
08/04/2025, 5:31 PMpy
08/04/2025, 5:34 PMpy
08/04/2025, 5:34 PMpy
08/04/2025, 5:35 PM