dev.mokkery.plugin.core.MokkeryLogApi.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mokkery-plugin Show documentation
Show all versions of mokkery-plugin Show documentation
Mokkery is a mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.
The newest version!
package dev.mokkery.plugin.core
import dev.mokkery.MokkeryConfig
import dev.mokkery.plugin.ir.locationInFile
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.ir.IrElement
internal inline fun TransformerScope.mokkeryErrorAt(element: IrElement, message: () -> String) {
messageCollector.report(
severity = CompilerMessageSeverity.ERROR,
message = message(),
location = element.locationInFile(currentFile)
)
}
internal inline fun TransformerScope.mokkeryLogAt(element: IrElement, message: () -> String) {
messageCollector.report(
severity = CompilerMessageSeverity.LOGGING,
message = "${MokkeryConfig.PLUGIN_ID}: ${message()}",
location = element.locationInFile(currentFile)
)
}
internal inline fun TransformerScope.mokkeryLog(message: () -> String) {
messageCollector.report(CompilerMessageSeverity.LOGGING, "${MokkeryConfig.PLUGIN_ID}: ${message()}")
}