All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.seskar.compiler.react.key.backend.KeyProvider.kt Maven / Gradle / Ivy

There is a newer version: 3.32.0
Show newest version
package seskar.compiler.react.key.backend

import org.jetbrains.kotlin.ir.IrFileEntry
import org.jetbrains.kotlin.ir.expressions.IrCall

@JvmInline
internal value class KeyProvider(
    private val fileEntry: IrFileEntry,
) {
    fun get(expression: IrCall): String {
        val startLine = fileEntry.getLineNumber(expression.startOffset)
        val startColumn = fileEntry.getColumnNumber(expression.startOffset)

        require(startLine >= 0 && startColumn >= 0) {
            "Invalid call location"
        }

        return "${startLine}_${startColumn}"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy