[IR] add new testdata after rebase
This commit is contained in:
committed by
teamcityserver
parent
3b1a6389ab
commit
a5b224fda1
@@ -0,0 +1,97 @@
|
||||
interface IrType {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface TypeRemapper {
|
||||
abstract fun enterScope(irTypeParametersContainer: IrTypeParametersContainer)
|
||||
abstract fun remapType(type: IrType): IrType
|
||||
abstract fun leaveScope()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface IrTypeParametersContainer : IrDeclaration, IrDeclarationParent {
|
||||
abstract var typeParameters: List<IrTypeParameter>
|
||||
abstract get
|
||||
abstract set
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface IrDeclaration {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface IrTypeParameter : IrDeclaration {
|
||||
abstract val superTypes: MutableList<IrType>
|
||||
abstract get
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface IrDeclarationParent {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
class DeepCopyIrTreeWithSymbols {
|
||||
constructor(typeRemapper: TypeRemapper) /* primary */ {
|
||||
TODO("IrDelegatingConstructorCall")
|
||||
/* InstanceInitializerCall */
|
||||
|
||||
}
|
||||
|
||||
private val typeRemapper: TypeRemapper
|
||||
field = typeRemapper
|
||||
private get
|
||||
|
||||
private fun copyTypeParameter(declaration: IrTypeParameter): IrTypeParameter {
|
||||
return declaration
|
||||
}
|
||||
|
||||
fun IrTypeParametersContainer.copyTypeParametersFrom(other: IrTypeParametersContainer) {
|
||||
<this>.<set-typeParameters>(<set-?> = map<IrTypeParameter, IrTypeParameter>($receiver = other.<get-typeParameters>(), transform = local fun <anonymous>(it: IrTypeParameter): IrTypeParameter {
|
||||
return <this>.copyTypeParameter(declaration = it)
|
||||
}
|
||||
))
|
||||
withinScope<Unit>($receiver = <this>.<get-typeRemapper>(), irTypeParametersContainer = <this>, fn = local fun <anonymous>() {
|
||||
{ //BLOCK
|
||||
val tmp0_iterator: Iterator<Pair<IrTypeParameter, IrTypeParameter>> = zip<IrTypeParameter, IrTypeParameter>($receiver = <this>.<get-typeParameters>(), other = other.<get-typeParameters>()).iterator()
|
||||
while (tmp0_iterator.hasNext()) { //BLOCK
|
||||
val tmp1_loop_parameter: Pair<IrTypeParameter, IrTypeParameter> = tmp0_iterator.next()
|
||||
val thisTypeParameter: IrTypeParameter = tmp1_loop_parameter.component1()
|
||||
val otherTypeParameter: IrTypeParameter = tmp1_loop_parameter.component2()
|
||||
{ //BLOCK
|
||||
mapTo<IrType, IrType, MutableList<IrType>>($receiver = otherTypeParameter.<get-superTypes>(), destination = thisTypeParameter.<get-superTypes>(), transform = local fun <anonymous>(it: IrType): IrType {
|
||||
return <this>.<get-typeRemapper>().remapType(type = it)
|
||||
}
|
||||
) /*~> Unit */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
inline fun <T : Any?> TypeRemapper.withinScope(irTypeParametersContainer: IrTypeParametersContainer, fn: Function0<T>): T {
|
||||
<this>.enterScope(irTypeParametersContainer = irTypeParametersContainer)
|
||||
val result: T = fn.invoke()
|
||||
<this>.leaveScope()
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user