IR: IrTypeAlias: serialize/deserialize new IR objects

Add uniqId for typealias declarations.
Implement WrappedTypeAliasDescriptor.
This commit is contained in:
Dmitry Petrov
2019-07-23 16:49:24 +03:00
parent b3525b077c
commit f590d4da9e
26 changed files with 2449 additions and 88 deletions
@@ -452,6 +452,8 @@ class DescriptorSerializer private constructor(
builder.addAnnotation(extension.annotationSerializer.serializeAnnotation(annotation))
}
extension.serializeTypeAlias(descriptor, builder)
return builder
}
@@ -83,6 +83,9 @@ abstract class SerializerExtension {
open fun serializeTypeParameter(typeParameter: TypeParameterDescriptor, proto: ProtoBuf.TypeParameter.Builder) {
}
open fun serializeTypeAlias(typeAlias: TypeAliasDescriptor, proto: ProtoBuf.TypeAlias.Builder) {
}
open fun serializeErrorType(type: KotlinType, builder: ProtoBuf.Type.Builder) {
throw IllegalStateException("Cannot serialize error type: $type")
}
@@ -106,4 +106,10 @@ abstract class KotlinSerializerExtensionBase(private val protocol: SerializerExt
proto.addExtension(protocol.typeParameterAnnotation, annotationSerializer.serializeAnnotation(annotation))
}
}
override fun serializeTypeAlias(typeAlias: TypeAliasDescriptor, proto: ProtoBuf.TypeAlias.Builder) {
// TODO serialize annotations on type aliases?
// (this requires more extensive protobuf scheme modifications)
}
}