[Common IR] Move local class from function to avoid a leak
This commit is contained in:
committed by
Space Team
parent
00e9544670
commit
dbf31b206c
+3
-5
@@ -191,11 +191,9 @@ class IrBodyDeserializer(
|
|||||||
return IrClassReferenceImpl(start, end, type, symbol, classType)
|
return IrClassReferenceImpl(start, end, type, symbol, classType)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deserializeAnnotation(proto: ProtoConstructorCall): IrConstructorCall {
|
|
||||||
|
|
||||||
// TODO: probably a bit more abstraction possible here up to `IrMemberAccessExpression`
|
// TODO: probably a bit more abstraction possible here up to `IrMemberAccessExpression`
|
||||||
// but at this point further complexization looks overengineered
|
// but at this point further complexization looks overengineered
|
||||||
class IrAnnotationType : IrDelegatedSimpleType() {
|
private class IrAnnotationType(private val builtIns: IrBuiltIns) : IrDelegatedSimpleType() {
|
||||||
|
|
||||||
var irConstructorCall: IrConstructorCall? = null
|
var irConstructorCall: IrConstructorCall? = null
|
||||||
|
|
||||||
@@ -222,7 +220,6 @@ class IrBodyDeserializer(
|
|||||||
buildSimpleType()
|
buildSimpleType()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i in typeParameters.indices) {
|
for (i in typeParameters.indices) {
|
||||||
val typeParameter = typeParameters[i]
|
val typeParameter = typeParameters[i]
|
||||||
val callTypeArgument = constructorCall.getTypeArgument(i) ?: error("No type argument for id $i")
|
val callTypeArgument = constructorCall.getTypeArgument(i) ?: error("No type argument for id $i")
|
||||||
@@ -236,7 +233,8 @@ class IrBodyDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val irType = IrAnnotationType()
|
fun deserializeAnnotation(proto: ProtoConstructorCall): IrConstructorCall {
|
||||||
|
val irType = IrAnnotationType(builtIns)
|
||||||
// TODO: use real coordinates
|
// TODO: use real coordinates
|
||||||
return deserializeConstructorCall(proto, 0, 0, irType).also { irType.irConstructorCall = it }
|
return deserializeConstructorCall(proto, 0, 0, irType).also { irType.irConstructorCall = it }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user