[IR] Use only empty constructor to create WrappedDescriptor
This commit is contained in:
+2
-2
@@ -515,8 +515,8 @@ class Fir2IrDeclarationStorage(
|
||||
): IrSimpleFunction {
|
||||
if (signature == null) {
|
||||
val descriptor =
|
||||
if (isGetter) WrappedPropertyGetterDescriptor(Annotations.EMPTY, SourceElement.NO_SOURCE)
|
||||
else WrappedPropertySetterDescriptor(Annotations.EMPTY, SourceElement.NO_SOURCE)
|
||||
if (isGetter) WrappedPropertyGetterDescriptor()
|
||||
else WrappedPropertySetterDescriptor()
|
||||
return symbolTable.declareSimpleFunction(descriptor, factory).apply { descriptor.bind(this) }
|
||||
}
|
||||
return symbolTable.declareSimpleFunction(signature, { Fir2IrSimpleFunctionSymbol(signature, containerSource) }, factory)
|
||||
|
||||
@@ -47,9 +47,9 @@ abstract class Fir2IrBindableSymbol<out D : DeclarationDescriptor, B : IrSymbolO
|
||||
containerSource != null ->
|
||||
WrappedFunctionDescriptorWithContainerSource()
|
||||
owner.name.isSpecial && owner.name.asString().startsWith(GETTER_PREFIX) ->
|
||||
WrappedPropertyGetterDescriptor(Annotations.EMPTY, SourceElement.NO_SOURCE)
|
||||
WrappedPropertyGetterDescriptor()
|
||||
owner.name.isSpecial && owner.name.asString().startsWith(SETTER_PREFIX) ->
|
||||
WrappedPropertySetterDescriptor(Annotations.EMPTY, SourceElement.NO_SOURCE)
|
||||
WrappedPropertySetterDescriptor()
|
||||
else ->
|
||||
WrappedSimpleFunctionDescriptor()
|
||||
}.apply { bind(owner) }
|
||||
|
||||
+12
-12
@@ -17,38 +17,38 @@ import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||
|
||||
object DescriptorsToIrRemapper : DescriptorsRemapper {
|
||||
override fun remapDeclaredClass(descriptor: ClassDescriptor) =
|
||||
WrappedClassDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedClassDescriptor()
|
||||
|
||||
override fun remapDeclaredConstructor(descriptor: ClassConstructorDescriptor) =
|
||||
WrappedClassConstructorDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedClassConstructorDescriptor()
|
||||
|
||||
override fun remapDeclaredEnumEntry(descriptor: ClassDescriptor) =
|
||||
WrappedClassDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedClassDescriptor()
|
||||
|
||||
override fun remapDeclaredField(descriptor: PropertyDescriptor) =
|
||||
WrappedFieldDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedFieldDescriptor()
|
||||
|
||||
override fun remapDeclaredSimpleFunction(descriptor: FunctionDescriptor) =
|
||||
when (descriptor) {
|
||||
is PropertyGetterDescriptor -> WrappedPropertyGetterDescriptor(descriptor.annotations, descriptor.source)
|
||||
is PropertySetterDescriptor -> WrappedPropertySetterDescriptor(descriptor.annotations, descriptor.source)
|
||||
else -> WrappedSimpleFunctionDescriptor(descriptor.annotations, descriptor.source)
|
||||
is PropertyGetterDescriptor -> WrappedPropertyGetterDescriptor()
|
||||
is PropertySetterDescriptor -> WrappedPropertySetterDescriptor()
|
||||
else -> WrappedSimpleFunctionDescriptor()
|
||||
}
|
||||
|
||||
override fun remapDeclaredProperty(descriptor: PropertyDescriptor) =
|
||||
WrappedPropertyDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedPropertyDescriptor()
|
||||
|
||||
override fun remapDeclaredTypeParameter(descriptor: TypeParameterDescriptor) =
|
||||
WrappedTypeParameterDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedTypeParameterDescriptor()
|
||||
|
||||
override fun remapDeclaredVariable(descriptor: VariableDescriptor) =
|
||||
WrappedVariableDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedVariableDescriptor()
|
||||
|
||||
override fun remapDeclaredValueParameter(descriptor: ParameterDescriptor): ParameterDescriptor =
|
||||
if (descriptor is ReceiverParameterDescriptor)
|
||||
WrappedReceiverParameterDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedReceiverParameterDescriptor()
|
||||
else
|
||||
WrappedValueParameterDescriptor(descriptor.annotations, descriptor.source)
|
||||
WrappedValueParameterDescriptor()
|
||||
}
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
|
||||
@@ -512,7 +512,7 @@ fun IrFactory.createStaticFunctionWithReceivers(
|
||||
): IrSimpleFunction {
|
||||
val descriptor = (oldFunction.descriptor as? DescriptorWithContainerSource)?.let {
|
||||
WrappedFunctionDescriptorWithContainerSource()
|
||||
} ?: WrappedSimpleFunctionDescriptor(Annotations.EMPTY, oldFunction.descriptor.source)
|
||||
} ?: WrappedSimpleFunctionDescriptor()
|
||||
return createFunction(
|
||||
oldFunction.startOffset, oldFunction.endOffset,
|
||||
origin,
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ fun <D> buildReceiverParameter(
|
||||
@PublishedApi
|
||||
internal fun IrFactory.buildValueParameter(builder: IrValueParameterBuilder, parent: IrDeclarationParent): IrValueParameter =
|
||||
with(builder) {
|
||||
val wrappedDescriptor = WrappedValueParameterDescriptor(wrappedDescriptorAnnotations)
|
||||
val wrappedDescriptor = WrappedValueParameterDescriptor()
|
||||
return createValueParameter(
|
||||
startOffset, endOffset, origin,
|
||||
IrValueParameterSymbolImpl(wrappedDescriptor),
|
||||
|
||||
-1
@@ -98,7 +98,6 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl
|
||||
): IrValueParameter {
|
||||
val parameter = this
|
||||
return buildValueParameter(target) {
|
||||
wrappedDescriptorAnnotations = descriptor.annotations
|
||||
origin = IrDeclarationOrigin.IR_BUILTINS_STUB
|
||||
name = parameter.name
|
||||
index = parameter.index
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ private class FileClassLowering(val context: JvmBackendContext) : FileLoweringPa
|
||||
val ktFile = context.psiSourceManager.getKtFile(fileEntry)
|
||||
?: throw AssertionError("Unexpected file entry: $fileEntry")
|
||||
fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(ktFile)
|
||||
descriptor = WrappedClassDescriptor(sourceElement = KotlinSourceElement(ktFile))
|
||||
descriptor = WrappedClassDescriptor()
|
||||
}
|
||||
is NaiveSourceBasedFileEntryImpl -> {
|
||||
fileClassInfo = JvmSimpleFileClassInfo(PackagePartClassUtils.getPackagePartFqName(irFile.fqName, fileEntry.name), false)
|
||||
|
||||
-1
@@ -18,7 +18,6 @@ abstract class IrDeclarationBuilder : IrElementBuilder() {
|
||||
var origin: IrDeclarationOrigin = IrDeclarationOrigin.DEFINED
|
||||
var visibility: Visibility = Visibilities.PUBLIC
|
||||
|
||||
var wrappedDescriptorAnnotations: Annotations = Annotations.EMPTY
|
||||
lateinit var name: Name
|
||||
|
||||
fun updateFrom(from: IrDeclaration) {
|
||||
|
||||
Reference in New Issue
Block a user