IR: make IrConst.copyWithOffsets an extension function

Co-authored-by: mcpiroman <mcpiroman@gmail.com>
This commit is contained in:
Alexander Udalov
2022-01-13 03:06:11 +01:00
parent 785eb83822
commit 3e7b1c027f
4 changed files with 9 additions and 9 deletions
@@ -11,8 +11,6 @@ abstract class IrConst<T> : IrExpression() {
abstract val kind: IrConstKind<T>
abstract val value: T
abstract fun copyWithOffsets(startOffset: Int, endOffset: Int): IrConst<T>
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitConst(this, data)
}
@@ -30,9 +30,6 @@ class IrConstImpl<T>(
override val kind: IrConstKind<T>,
override val value: T
) : IrConst<T>() {
override fun copyWithOffsets(startOffset: Int, endOffset: Int) =
IrConstImpl(startOffset, endOffset, type, kind, value)
companion object {
fun string(startOffset: Int, endOffset: Int, type: IrType, value: String): IrConstImpl<String> =
IrConstImpl(startOffset, endOffset, type, IrConstKind.String, value)
@@ -86,3 +83,6 @@ class IrConstImpl<T>(
}
}
}
fun <T> IrConst<T>.copyWithOffsets(startOffset: Int, endOffset: Int) =
IrConstImpl(startOffset, endOffset, type, kind, value)