Get rid of reification from 'deepCopyWithVariables'

This commit is contained in:
Mikhael Bogdanov
2017-08-08 13:32:04 +02:00
parent 49612063dc
commit 3ae084b1b3
@@ -24,7 +24,8 @@ import org.jetbrains.kotlin.ir.util.DeepCopySymbolsRemapper
import org.jetbrains.kotlin.ir.util.DescriptorsRemapper
import org.jetbrains.kotlin.ir.visitors.acceptVoid
fun IrElement.deepCopyWithVariablesImpl(): IrElement {
@Suppress("UNCHECKED_CAST")
fun <T : IrElement> T.deepCopyWithVariables(): T {
val descriptorsRemapper = object : DescriptorsRemapper {
override fun remapDeclaredVariable(descriptor: VariableDescriptor) = LocalVariableDescriptor(
/* containingDeclaration = */ descriptor.containingDeclaration,
@@ -47,8 +48,5 @@ fun IrElement.deepCopyWithVariablesImpl(): IrElement {
}
},
null
)
}
inline fun <reified T : IrElement> T.deepCopyWithVariables(): T =
this.deepCopyWithVariablesImpl() as T
) as T
}