IR: make IrGetValue.copyWithOffsets an extension function

This commit is contained in:
Alexander Udalov
2022-01-18 22:48:36 +01:00
parent bb77078362
commit 1303ac4848
3 changed files with 3 additions and 8 deletions
@@ -662,9 +662,6 @@ class FunctionInlining(
fun withLocation(startOffset: Int, endOffset: Int) =
IrGetValueImpl(startOffset, endOffset, type, symbol, origin)
override fun copyWithOffsets(newStartOffset: Int, newEndOffset: Int): IrGetValue =
withLocation(newStartOffset, newEndOffset)
}
}
@@ -8,8 +8,6 @@ package org.jetbrains.kotlin.ir.expressions
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
abstract class IrGetValue : IrValueAccessExpression() {
abstract fun copyWithOffsets(newStartOffset: Int, newEndOffset: Int): IrGetValue
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitGetValue(this, data)
}
@@ -23,7 +23,7 @@ class IrGetValueImpl(
symbol: IrValueSymbol,
origin: IrStatementOrigin? = null
) : this(startOffset, endOffset, symbol.owner.type, symbol, origin)
override fun copyWithOffsets(newStartOffset: Int, newEndOffset: Int): IrGetValue =
IrGetValueImpl(newStartOffset, newEndOffset, type, symbol, origin)
}
fun IrGetValue.copyWithOffsets(newStartOffset: Int, newEndOffset: Int): IrGetValue =
IrGetValueImpl(newStartOffset, newEndOffset, type, symbol, origin)