IR: remove WrappedDescriptors altogether
This commit is contained in:
+1
-20
@@ -1046,9 +1046,6 @@ abstract class IrFileDeserializer(
|
||||
).apply {
|
||||
if (proto.hasDefaultValue())
|
||||
defaultValue = irFactory.createExpressionBody(deserializeExpressionBody(proto.defaultValue))
|
||||
|
||||
(descriptor as? WrappedValueParameterDescriptor)?.bind(this)
|
||||
(descriptor as? WrappedReceiverParameterDescriptor)?.bind(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,9 +1107,7 @@ abstract class IrFileDeserializer(
|
||||
private fun deserializeErrorDeclaration(proto: ProtoErrorDeclaration): IrErrorDeclaration {
|
||||
require(allowErrorNodes) { "IrErrorDeclaration found but error code is not allowed" }
|
||||
val coordinates = BinaryCoordinates.decode(proto.coordinates)
|
||||
val descriptor = WrappedErrorDescriptor()
|
||||
return irFactory.createErrorDeclaration(coordinates.startOffset, coordinates.endOffset, descriptor).also {
|
||||
descriptor.bind(it)
|
||||
return irFactory.createErrorDeclaration(coordinates.startOffset, coordinates.endOffset).also {
|
||||
it.parent = parentsStack.peek()!!
|
||||
}
|
||||
}
|
||||
@@ -1241,8 +1236,6 @@ abstract class IrFileDeserializer(
|
||||
)
|
||||
}.apply {
|
||||
overriddenSymbols = proto.overriddenList.map { deserializeIrSymbolAndRemap(it) as IrSimpleFunctionSymbol }
|
||||
|
||||
(descriptor as? WrappedSimpleFunctionDescriptor)?.bind(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1262,8 +1255,6 @@ abstract class IrFileDeserializer(
|
||||
).apply {
|
||||
if (proto.hasInitializer())
|
||||
initializer = deserializeExpression(proto.initializer)
|
||||
|
||||
(descriptor as? WrappedVariableDescriptor)?.bind(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1350,8 +1341,6 @@ abstract class IrFileDeserializer(
|
||||
getter = deserializeIrFunction(proto.getter)
|
||||
if (proto.hasSetter())
|
||||
setter = deserializeIrFunction(proto.setter)
|
||||
|
||||
(descriptor as? WrappedVariableDescriptorWithAccessor)?.bind(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1387,17 +1376,9 @@ abstract class IrFileDeserializer(
|
||||
}
|
||||
if (proto.hasBackingField()) {
|
||||
backingField = deserializeIrField(proto.backingField).also {
|
||||
// A property symbol and its field symbol share the same descriptor.
|
||||
// Unfortunately symbol deserialization doesn't know anything about that.
|
||||
// So we can end up with two wrapped property descriptors for property and its field.
|
||||
// In that case we need to bind the field's one here.
|
||||
if (descriptor != it.descriptor)
|
||||
(it.descriptor as? WrappedPropertyDescriptor)?.bind(this)
|
||||
it.correspondingPropertySymbol = symbol
|
||||
}
|
||||
}
|
||||
|
||||
(descriptor as? WrappedPropertyDescriptor)?.bind(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrAbstractFunctionFactory
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedDeclarationDescriptor
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.library.IrLibrary
|
||||
@@ -42,7 +41,7 @@ abstract class IrModuleDeserializer(val moduleDescriptor: ModuleDescriptor) {
|
||||
open fun declareIrSymbol(symbol: IrSymbol) {
|
||||
val signature = symbol.signature
|
||||
require(signature != null) { "Symbol is not public API: ${symbol.descriptor}" }
|
||||
assert(symbol.descriptor !is WrappedDeclarationDescriptor<*>)
|
||||
assert(symbol.hasDescriptor)
|
||||
deserializeIrSymbol(signature, symbol.kind())
|
||||
}
|
||||
|
||||
@@ -69,7 +68,7 @@ abstract class IrModuleDeserializer(val moduleDescriptor: ModuleDescriptor) {
|
||||
|
||||
// Used to resolve built in symbols like `kotlin.ir.internal.*` or `kotlin.FunctionN`
|
||||
class IrModuleDeserializerWithBuiltIns(
|
||||
private val builtIns: IrBuiltIns,
|
||||
builtIns: IrBuiltIns,
|
||||
private val functionFactory: IrAbstractFunctionFactory,
|
||||
private val delegate: IrModuleDeserializer
|
||||
) : IrModuleDeserializer(delegate.moduleDescriptor) {
|
||||
|
||||
-3
@@ -556,8 +556,6 @@ abstract class KotlinIrLinker(
|
||||
if (!symbol.hasDescriptor) return null
|
||||
|
||||
val descriptor = symbol.descriptor
|
||||
|
||||
if (descriptor is WrappedDeclarationDescriptor<*>) return null
|
||||
if (descriptor is CallableMemberDescriptor) {
|
||||
if (descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
|
||||
// skip fake overrides
|
||||
@@ -578,7 +576,6 @@ abstract class KotlinIrLinker(
|
||||
|
||||
if (!symbol.isPublicApi) {
|
||||
val descriptor = symbol.descriptor
|
||||
if (descriptor is WrappedDeclarationDescriptor<*>) return null
|
||||
if (!platformSpecificSymbol(symbol)) {
|
||||
if (descriptor.module !== currentModule) return null
|
||||
}
|
||||
|
||||
-3
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.backend.common.serialization.signature
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedDeclarationDescriptor
|
||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.ir.util.IdSignatureComposer
|
||||
import org.jetbrains.kotlin.ir.util.KotlinMangler
|
||||
@@ -109,14 +108,12 @@ open class IdSignatureDescriptor(private val mangler: KotlinMangler.DescriptorMa
|
||||
private val composer by lazy { createSignatureBuilder() }
|
||||
|
||||
override fun composeSignature(descriptor: DeclarationDescriptor): IdSignature? {
|
||||
if (descriptor is WrappedDeclarationDescriptor<*>) return null
|
||||
return if (mangler.run { descriptor.isExported() }) {
|
||||
composer.buildSignature(descriptor)
|
||||
} else null
|
||||
}
|
||||
|
||||
override fun composeEnumEntrySignature(descriptor: ClassDescriptor): IdSignature? {
|
||||
if (descriptor is WrappedDeclarationDescriptor<*>) return null
|
||||
return if (mangler.run { descriptor.isExportEnumEntry() }) {
|
||||
composer.buildSignature(descriptor)
|
||||
} else null
|
||||
|
||||
Reference in New Issue
Block a user