JS: serialize type of local anonymous class as its denotable supertype. See KT-14888
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.resolve.constants.NullValue
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
open class KotlinSerializerExtensionBase(private val protocol: SerializerExtensionProtocol) : SerializerExtension() {
|
||||
override final val stringTable = StringTableImpl()
|
||||
override val stringTable = StringTableImpl()
|
||||
|
||||
override fun serializeClass(descriptor: ClassDescriptor, proto: ProtoBuf.Class.Builder) {
|
||||
for (annotation in descriptor.annotations) {
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.utils.Interner
|
||||
import java.io.OutputStream
|
||||
|
||||
class StringTableImpl : StringTable {
|
||||
open class StringTableImpl : StringTable {
|
||||
private class FqNameProto(val fqName: QualifiedName.Builder) {
|
||||
override fun hashCode(): Int {
|
||||
var result = 13
|
||||
@@ -72,7 +72,7 @@ class StringTableImpl : StringTable {
|
||||
is ClassDescriptor -> {
|
||||
builder.parentQualifiedName = getFqNameIndex(containingDeclaration)
|
||||
}
|
||||
else -> throw IllegalStateException("Cannot get FQ name of local class: " + descriptor)
|
||||
else -> return getFqNameIndexOfLocalAnonymousClass(descriptor)
|
||||
}
|
||||
|
||||
builder.shortName = getStringIndex(descriptor.name.asString())
|
||||
@@ -80,6 +80,10 @@ class StringTableImpl : StringTable {
|
||||
return qualifiedNames.intern(FqNameProto(builder))
|
||||
}
|
||||
|
||||
open fun getFqNameIndexOfLocalAnonymousClass(descriptor: ClassifierDescriptorWithTypeParameters): Int {
|
||||
throw IllegalStateException("Cannot get FQ name of local class: " + descriptor)
|
||||
}
|
||||
|
||||
fun getPackageFqNameIndex(fqName: FqName): Int {
|
||||
var result = -1
|
||||
for (segment in fqName.pathSegments()) {
|
||||
|
||||
Reference in New Issue
Block a user