Added support of MetaSerializable to the FIR
This commit is contained in:
committed by
Space Team
parent
28340459b0
commit
503f4d924d
+2
-15
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user