IR API: change val ... : MutableList to var ...: List for most lists
All mutable state for IR declarations should be either: - var (mutable properties) - or class member list Mutable properties are straightforward to persist. The class member list is handled in a special way.
This commit is contained in:
+4
-5
@@ -44,7 +44,7 @@ interface IrBuilderExtension {
|
||||
private fun IrClass.declareSimpleFunctionWithExternalOverrides(descriptor: FunctionDescriptor): IrSimpleFunction {
|
||||
return compilerContext.symbolTable.declareSimpleFunction(startOffset, endOffset, SERIALIZABLE_PLUGIN_ORIGIN, descriptor)
|
||||
.also { f ->
|
||||
descriptor.overriddenDescriptors.mapTo(f.overriddenSymbols) {
|
||||
f.overriddenSymbols = descriptor.overriddenDescriptors.map {
|
||||
compilerContext.symbolTable.referenceSimpleFunction(it.original)
|
||||
}
|
||||
}
|
||||
@@ -357,16 +357,15 @@ interface IrBuilderExtension {
|
||||
|
||||
if (!overwriteValueParameters)
|
||||
assert(valueParameters.isEmpty())
|
||||
else
|
||||
valueParameters.clear()
|
||||
valueParameters.addAll(descriptor.valueParameters.map { it.irValueParameter() })
|
||||
|
||||
valueParameters = descriptor.valueParameters.map { it.irValueParameter() }
|
||||
|
||||
assert(typeParameters.isEmpty())
|
||||
if (copyTypeParameters) copyTypeParamsFromDescriptor()
|
||||
}
|
||||
|
||||
fun IrFunction.copyTypeParamsFromDescriptor() {
|
||||
descriptor.typeParameters.mapTo(typeParameters) {
|
||||
typeParameters += descriptor.typeParameters.map {
|
||||
IrTypeParameterImpl(
|
||||
startOffset, endOffset,
|
||||
SERIALIZABLE_PLUGIN_ORIGIN,
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ class SerializableCompanionIrGenerator(
|
||||
)
|
||||
}
|
||||
|
||||
irSerializableClass.annotations.add(annotationCtorCall)
|
||||
irSerializableClass.annotations += annotationCtorCall
|
||||
}
|
||||
|
||||
override fun generateSerializerGetter(methodDescriptor: FunctionDescriptor) {
|
||||
|
||||
Reference in New Issue
Block a user