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