FIR2IR: don't create signatures also for accessors & constructors

This commit is contained in:
Mikhail Glukhikh
2022-06-29 16:16:21 +02:00
committed by Space
parent 2880cd8d5a
commit e95fe060d6
@@ -625,7 +625,10 @@ class Fir2IrDeclarationStorage(
): IrConstructor = convertCatching(constructor) { ): IrConstructor = convertCatching(constructor) {
val origin = constructor.computeIrOrigin(predefinedOrigin) val origin = constructor.computeIrOrigin(predefinedOrigin)
val isPrimary = constructor.isPrimary val isPrimary = constructor.isPrimary
val signature = if (isLocal) null else signatureComposer.composeSignature(constructor, forceTopLevelPrivate = forceTopLevelPrivate) val signature =
runUnless(isLocal || !generateSignatures) {
signatureComposer.composeSignature(constructor, forceTopLevelPrivate = forceTopLevelPrivate)
}
val created = constructor.convertWithOffsets { startOffset, endOffset -> val created = constructor.convertWithOffsets { startOffset, endOffset ->
declareIrConstructor(signature) { symbol -> declareIrConstructor(signature) { symbol ->
classifierStorage.preCacheTypeParameters(constructor, symbol) classifierStorage.preCacheTypeParameters(constructor, symbol)
@@ -678,13 +681,16 @@ class Fir2IrDeclarationStorage(
origin: IrDeclarationOrigin, origin: IrDeclarationOrigin,
startOffset: Int, startOffset: Int,
endOffset: Int, endOffset: Int,
isLocal: Boolean = false, dontUseSignature: Boolean = false,
containingClass: ConeClassLikeLookupTag? = null, containingClass: ConeClassLikeLookupTag? = null,
propertyAccessorForAnnotations: FirPropertyAccessor? = propertyAccessor, propertyAccessorForAnnotations: FirPropertyAccessor? = propertyAccessor,
forceTopLevelPrivate: Boolean = false, forceTopLevelPrivate: Boolean = false,
): IrSimpleFunction = convertCatching(propertyAccessor ?: property) { ): IrSimpleFunction = convertCatching(propertyAccessor ?: property) {
val prefix = if (isSetter) "set" else "get" val prefix = if (isSetter) "set" else "get"
val signature = if (isLocal) null else signatureComposer.composeAccessorSignature(property, isSetter, containingClass, forceTopLevelPrivate) val signature =
runUnless(dontUseSignature) {
signatureComposer.composeAccessorSignature(property, isSetter, containingClass, forceTopLevelPrivate)
}
val containerSource = (correspondingProperty as? IrProperty)?.containerSource val containerSource = (correspondingProperty as? IrProperty)?.containerSource
return declareIrAccessor( return declareIrAccessor(
signature, signature,
@@ -929,7 +935,8 @@ class Fir2IrDeclarationStorage(
getter is FirDefaultPropertyGetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR getter is FirDefaultPropertyGetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
else -> origin else -> origin
}, },
startOffset, endOffset, isLocal, containingClass, startOffset, endOffset,
dontUseSignature = signature == null, containingClass,
property.unwrapFakeOverrides().getter, property.unwrapFakeOverrides().getter,
forceTopLevelPrivate = forceTopLevelPrivate, forceTopLevelPrivate = forceTopLevelPrivate,
) )
@@ -941,7 +948,8 @@ class Fir2IrDeclarationStorage(
setter is FirDefaultPropertySetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR setter is FirDefaultPropertySetter -> IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
else -> origin else -> origin
}, },
startOffset, endOffset, isLocal, containingClass, startOffset, endOffset,
dontUseSignature = signature == null, containingClass,
property.unwrapFakeOverrides().setter, property.unwrapFakeOverrides().setter,
forceTopLevelPrivate = forceTopLevelPrivate, forceTopLevelPrivate = forceTopLevelPrivate,
) )
@@ -1210,12 +1218,12 @@ class Fir2IrDeclarationStorage(
delegate.parent = irParent delegate.parent = irParent
getter = createIrPropertyAccessor( getter = createIrPropertyAccessor(
property.getter, property, this, type, irParent, null, false, property.getter, property, this, type, irParent, null, false,
IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, startOffset, endOffset, isLocal IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, startOffset, endOffset, dontUseSignature = true
) )
if (property.isVar) { if (property.isVar) {
setter = createIrPropertyAccessor( setter = createIrPropertyAccessor(
property.setter, property, this, type, irParent, null, true, property.setter, property, this, type, irParent, null, true,
IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, startOffset, endOffset, isLocal IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, startOffset, endOffset, dontUseSignature = true
) )
} }
leaveScope(this) leaveScope(this)