Adapt serialization exceptions constructor calls to signature change
(see https://github.com/Kotlin/kotlinx.serialization/pull/1054)
This commit is contained in:
+3
-4
@@ -15,9 +15,7 @@ import org.jetbrains.kotlin.ir.builders.*
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.types.IrTypeProjection
|
||||
import org.jetbrains.kotlin.ir.types.classOrNull
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.util.getAnnotation
|
||||
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
|
||||
import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi
|
||||
@@ -55,7 +53,8 @@ class SerializableIrGenerator(
|
||||
|
||||
// Missing field exception parts
|
||||
val exceptionFqn = getSerializationPackageFqn(MISSING_FIELD_EXC)
|
||||
val exceptionCtorRef = compilerContext.referenceConstructors(exceptionFqn).single { it.owner.isPrimary }
|
||||
val exceptionCtorRef = compilerContext.referenceConstructors(exceptionFqn)
|
||||
.single { it.owner.valueParameters.singleOrNull()?.type?.isString() == true }
|
||||
val exceptionType = exceptionCtorRef.owner.returnType
|
||||
|
||||
val serializableProperties = properties.serializableProperties
|
||||
|
||||
+2
-1
@@ -452,7 +452,8 @@ open class SerializerIrGenerator(val irClass: IrClass, final override val compil
|
||||
// throw exception on unknown field
|
||||
|
||||
val exceptionFqn = getSerializationPackageFqn(UNKNOWN_FIELD_EXC)
|
||||
val excClassRef = compilerContext.referenceConstructors(exceptionFqn).single { it.owner.isPrimary }
|
||||
val excClassRef = compilerContext.referenceConstructors(exceptionFqn)
|
||||
.single { it.owner.valueParameters.singleOrNull()?.type?.isInt() == true }
|
||||
+elseBranch(
|
||||
irThrow(
|
||||
irInvoke(
|
||||
|
||||
Reference in New Issue
Block a user