IR: remove IrCallableReference.referencedName

It was added in 66da676b9e to avoid dependency on descriptors, but now
it doesn't use descriptors anyway, so it's better to inline it than have
it in the interface.
This commit is contained in:
Alexander Udalov
2023-02-13 14:37:36 +01:00
committed by Space Team
parent d286409b76
commit 42daeaaa80
7 changed files with 4 additions and 21 deletions
@@ -348,7 +348,7 @@ internal class PropertyReferenceLowering(val context: JvmBackendContext) : IrEle
var index = 0
receiver?.let { call.putValueArgument(index++, it) }
call.putValueArgument(index++, containerClass)
call.putValueArgument(index++, irString(expression.referencedName.asString()))
call.putValueArgument(index++, irString((expression.symbol.owner as IrDeclarationWithName).name.asString()))
call.putValueArgument(index++, computeSignatureString(expression))
if (useOptimizedSuperClass) {
val isPackage = (container is IrClass && container.isFileClass) || container is IrPackageFragment
@@ -407,7 +407,7 @@ internal class PropertyReferenceLowering(val context: JvmBackendContext) : IrEle
val getName = superClass.functions.single { it.name.asString() == "getName" }
val getOwner = superClass.functions.single { it.name.asString() == "getOwner" }
val getSignature = superClass.functions.single { it.name.asString() == "getSignature" }
referenceClass.addOverride(getName) { irString(expression.referencedName.asString()) }
referenceClass.addOverride(getName) { irString((expression.symbol.owner as IrDeclarationWithName).name.asString()) }
referenceClass.addOverride(getOwner) { calculateOwner(expression.propertyContainer) }
referenceClass.addOverride(getSignature) { computeSignatureString(expression) }
}
@@ -9,12 +9,9 @@
package org.jetbrains.kotlin.ir.expressions
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.name.Name
/**
* A non-leaf IR tree element.
* @sample org.jetbrains.kotlin.ir.generator.IrTree.callableReference
*/
abstract class IrCallableReference<S : IrSymbol> : IrMemberAccessExpression<S>() {
abstract val referencedName: Name
}
abstract class IrCallableReference<S : IrSymbol> : IrMemberAccessExpression<S>()
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.ir.expressions.IrFunctionReference
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
class IrFunctionReferenceImpl(
override val startOffset: Int,
@@ -34,9 +33,6 @@ class IrFunctionReferenceImpl(
override val reflectionTarget: IrFunctionSymbol? = symbol,
override val origin: IrStatementOrigin? = null,
) : IrFunctionReference() {
override val referencedName: Name
get() = symbol.owner.name
override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount)
override val argumentsByParameterIndex: Array<IrExpression?> = arrayOfNulls(valueArgumentsCount)
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
class IrLocalDelegatedPropertyReferenceImpl(
override val startOffset: Int,
@@ -42,7 +41,4 @@ class IrLocalDelegatedPropertyReferenceImpl(
override val valueArgumentsCount: Int
get() = 0
override val referencedName: Name
get() = symbol.owner.name
}
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
class IrPropertyReferenceImpl(
override val startOffset: Int,
@@ -43,7 +42,4 @@ class IrPropertyReferenceImpl(
override val valueArgumentsCount: Int
get() = 0
override val referencedName: Name
get() = symbol.owner.name
}
@@ -1401,7 +1401,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
}
printMemberAccessExpressionWithNoIndent(
referencedName.asString(), // effectively it's same as `symbol.owner.name.asString()`
(symbol.owner as IrDeclarationWithName).name.asString(),
valueParameters,
superQualifierSymbol = null,
omitAllBracketsIfNoArguments = true,
@@ -688,8 +688,6 @@ object IrTree : AbstractTreeBuilder() {
val s = +param("S", symbolType)
parent(memberAccessExpression.withArgs("S" to s))
+field("referencedName", type<Name>())
}
val functionReference: ElementConfig by element(Expression) {
visitorParent = callableReference