FIR: Support (de)serialization of context receivers
This commit is contained in:
+29
@@ -189,6 +189,17 @@ class FirElementSerializer private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
if (klass is FirRegularClass) {
|
||||
for (contextReceiver in klass.contextReceivers) {
|
||||
val typeRef = contextReceiver.typeRef
|
||||
if (useTypeTable()) {
|
||||
builder.addContextReceiverTypeId(typeId(typeRef))
|
||||
} else {
|
||||
builder.addContextReceiverType(typeProto(contextReceiver.typeRef))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (versionRequirementTable == null) error("Version requirements must be serialized for classes: ${klass.render()}")
|
||||
|
||||
builder.addAllVersionRequirement(versionRequirementTable.serializeVersionRequirements(klass))
|
||||
@@ -312,6 +323,15 @@ class FirElementSerializer private constructor(
|
||||
builder.addTypeParameter(local.typeParameterProto(typeParameter))
|
||||
}
|
||||
|
||||
for (contextReceiver in property.contextReceivers) {
|
||||
val typeRef = contextReceiver.typeRef
|
||||
if (useTypeTable()) {
|
||||
builder.addContextReceiverTypeId(typeId(typeRef))
|
||||
} else {
|
||||
builder.addContextReceiverType(typeProto(contextReceiver.typeRef))
|
||||
}
|
||||
}
|
||||
|
||||
val receiverTypeRef = property.receiverTypeRef
|
||||
if (receiverTypeRef != null) {
|
||||
if (useTypeTable()) {
|
||||
@@ -386,6 +406,15 @@ class FirElementSerializer private constructor(
|
||||
builder.addTypeParameter(local.typeParameterProto(typeParameter))
|
||||
}
|
||||
|
||||
for (contextReceiver in function.contextReceivers) {
|
||||
val typeRef = contextReceiver.typeRef
|
||||
if (useTypeTable()) {
|
||||
builder.addContextReceiverTypeId(typeId(typeRef))
|
||||
} else {
|
||||
builder.addContextReceiverType(typeProto(contextReceiver.typeRef))
|
||||
}
|
||||
}
|
||||
|
||||
val receiverTypeRef = function.receiverTypeRef
|
||||
if (receiverTypeRef != null) {
|
||||
if (useTypeTable()) {
|
||||
|
||||
Reference in New Issue
Block a user