Added support of MetaSerializable to the FIR

This commit is contained in:
Sergey.Shanshin
2022-10-12 20:10:58 +00:00
committed by Space Team
parent 28340459b0
commit 503f4d924d
13 changed files with 980 additions and 233 deletions
@@ -367,20 +367,7 @@ interface IrBuilderWithPluginContext {
val annotationClass = annotationCall.symbol.owner.parentAsClass
if (!annotationClass.isSerialInfoAnnotation) return@mapNotNull null
if (compilerContext.platform.isJvm()) {
val implClass = compilerContext.serialInfoImplJvmIrGenerator.getImplClass(annotationClass)
val ctor = implClass.constructors.singleOrNull { it.valueParameters.size == annotationCall.valueArgumentsCount }
?: error("No constructor args found for SerialInfo annotation Impl class: ${implClass.render()}")
irCall(ctor).apply {
for (i in 0 until annotationCall.valueArgumentsCount) {
val argument = annotationCall.getValueArgument(i)
?: annotationClass.primaryConstructor!!.valueParameters[i].defaultValue?.expression
putValueArgument(i, argument!!.deepCopyWithVariables())
}
}
} else {
annotationCall.deepCopyWithVariables()
}
annotationCall.deepCopyWithVariables()
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
@@ -400,4 +387,4 @@ interface IrBuilderWithPluginContext {
}
fun IrClass.getSuperClassOrAny(): IrClass = getSuperClassNotAny() ?: compilerContext.irBuiltIns.anyClass.owner
}
}