[Wasm] Require a description on each usage of SourceLocation.NoLocation

This commit is contained in:
Zalim Bashorov
2022-12-06 19:43:59 +01:00
parent 61440c74d5
commit cdc1d66b1f
4 changed files with 11 additions and 6 deletions
@@ -10,6 +10,6 @@ value class LocationHolder(val location: SourceLocation)
inline fun <R> withLocation(location: SourceLocation, body: LocationHolder.() -> R): R = LocationHolder(location).body()
inline fun <R> withNoLocation(body: LocationHolder.() -> R): R = withLocation(SourceLocation.NoLocation, body)
inline fun <R> withNoLocation(description: String, body: LocationHolder.() -> R): R = withLocation(SourceLocation.NoLocation(description), body)
inline fun <R> withTBDLocation(body: LocationHolder.() -> R): R = withLocation<R>(SourceLocation.TBDLocation, body)
@@ -6,8 +6,13 @@
package org.jetbrains.kotlin.wasm.ir.source.location
sealed class SourceLocation {
object NoLocation: SourceLocation()
object TBDLocation: SourceLocation()
private object NoLocation : SourceLocation()
object TBDLocation : SourceLocation()
data class Location(val file: String, val line: Int, val column: Int) : SourceLocation()
companion object {
@Suppress("FunctionName", "UNUSED_PARAMETER")
fun NoLocation(description: String): SourceLocation = NoLocation
}
}