[IR] Add MFVC representation during serialization of FIR to IR
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com> #KT-1179
This commit is contained in:
committed by
Space Team
parent
5b868becf4
commit
394cd944b6
+23
-15
@@ -9,10 +9,7 @@ import org.jetbrains.kotlin.builtins.StandardNames
|
|||||||
import org.jetbrains.kotlin.builtins.functions.FunctionTypeKind
|
import org.jetbrains.kotlin.builtins.functions.FunctionTypeKind
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||||
import org.jetbrains.kotlin.fir.*
|
import org.jetbrains.kotlin.fir.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
@@ -218,21 +215,32 @@ class FirElementSerializer private constructor(
|
|||||||
builder.companionObjectName = getSimpleNameIndex(companionObject.name)
|
builder.companionObjectName = getSimpleNameIndex(companionObject.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
val representation = (klass as? FirRegularClass)?.inlineClassRepresentation
|
when (val representation = (klass as? FirRegularClass)?.valueClassRepresentation) {
|
||||||
if (representation != null) {
|
is InlineClassRepresentation -> {
|
||||||
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(representation.underlyingPropertyName)
|
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(representation.underlyingPropertyName)
|
||||||
|
|
||||||
val property = callableMembers.single {
|
val property = callableMembers.single {
|
||||||
it is FirProperty && it.receiverParameter == null && it.name == representation.underlyingPropertyName
|
it is FirProperty && it.receiverParameter == null && it.name == representation.underlyingPropertyName
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!property.visibility.isPublicAPI) {
|
if (!property.visibility.isPublicAPI) {
|
||||||
if (useTypeTable()) {
|
if (useTypeTable()) {
|
||||||
builder.inlineClassUnderlyingTypeId = typeId(representation.underlyingType)
|
builder.inlineClassUnderlyingTypeId = typeId(representation.underlyingType)
|
||||||
} else {
|
} else {
|
||||||
builder.setInlineClassUnderlyingType(typeProto(representation.underlyingType))
|
builder.setInlineClassUnderlyingType(typeProto(representation.underlyingType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is MultiFieldValueClassRepresentation -> {
|
||||||
|
val namesToTypes = representation.underlyingPropertyNamesToTypes
|
||||||
|
builder.addAllMultiFieldValueClassUnderlyingName(namesToTypes.map { (name, _) -> getSimpleNameIndex(name) })
|
||||||
|
if (useTypeTable()) {
|
||||||
|
builder.addAllMultiFieldValueClassUnderlyingTypeId(namesToTypes.map { (_, kotlinType) -> typeId(kotlinType) })
|
||||||
|
} else {
|
||||||
|
builder.addAllMultiFieldValueClassUnderlyingType(namesToTypes.map { (_, kotlinType) -> typeProto(kotlinType).build() })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
null -> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (klass is FirRegularClass) {
|
if (klass is FirRegularClass) {
|
||||||
|
|||||||
Reference in New Issue
Block a user