[FIR2IR] Minor: reuse calculated expression
This commit is contained in:
+5
-5
@@ -517,21 +517,21 @@ class ExpressionsConverter(
|
||||
var firSelector: FirExpression? = null
|
||||
var firReceiver: FirExpression? = null //before dot
|
||||
dotQualifiedExpression.forEachChildren {
|
||||
when (it.tokenType) {
|
||||
when (val tokenType = it.tokenType) {
|
||||
DOT -> isSelector = true
|
||||
SAFE_ACCESS -> {
|
||||
isSafe = true
|
||||
isSelector = true
|
||||
}
|
||||
else -> {
|
||||
val isEffectiveSelector = isSelector && it.tokenType != TokenType.ERROR_ELEMENT
|
||||
val isEffectiveSelector = isSelector && tokenType != TokenType.ERROR_ELEMENT
|
||||
val firExpression =
|
||||
getAsFirExpression<FirExpression>(it, "Incorrect ${if (isEffectiveSelector) "selector" else "receiver"} expression")
|
||||
if (isEffectiveSelector) {
|
||||
val callExpressionCallee = if (it.tokenType == CALL_EXPRESSION) it.getFirstChildExpressionUnwrapped() else null
|
||||
val callExpressionCallee = if (tokenType == CALL_EXPRESSION) it.getFirstChildExpressionUnwrapped() else null
|
||||
firSelector =
|
||||
if (it.tokenType is KtNameReferenceExpressionElementType ||
|
||||
(it.tokenType == CALL_EXPRESSION && callExpressionCallee?.tokenType != LAMBDA_EXPRESSION)
|
||||
if (tokenType is KtNameReferenceExpressionElementType ||
|
||||
(tokenType == CALL_EXPRESSION && callExpressionCallee?.tokenType != LAMBDA_EXPRESSION)
|
||||
) {
|
||||
firExpression
|
||||
} else {
|
||||
|
||||
@@ -69,14 +69,10 @@ private fun FirMemberDeclaration.getBackingFieldIfApplicable(): FirBackingField?
|
||||
|
||||
// This check prevents resolving protected and
|
||||
// public fields.
|
||||
val visibility = field.visibility
|
||||
if (
|
||||
visibility == Visibilities.PrivateToThis ||
|
||||
visibility == Visibilities.Private ||
|
||||
visibility == Visibilities.Internal
|
||||
) {
|
||||
return field
|
||||
return when (field.visibility) {
|
||||
Visibilities.PrivateToThis,
|
||||
Visibilities.Private,
|
||||
Visibilities.Internal -> field
|
||||
else -> null
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
+4
-3
@@ -166,10 +166,11 @@ internal class PropertyReferenceLowering(val context: JvmBackendContext) : IrEle
|
||||
|
||||
private fun propertyReferenceKind(expression: IrCallableReference<*>, mutable: Boolean, i: Int): PropertyReferenceKind {
|
||||
check(i in 0..2) { "Incorrect number of receivers ($i) for property reference: ${expression.render()}" }
|
||||
val symbols = context.ir.symbols
|
||||
return PropertyReferenceKind(
|
||||
context.ir.symbols.getPropertyReferenceClass(mutable, i, false),
|
||||
context.ir.symbols.getPropertyReferenceClass(mutable, i, true),
|
||||
context.ir.symbols.reflection.owner.functions.single {
|
||||
symbols.getPropertyReferenceClass(mutable, i, false),
|
||||
symbols.getPropertyReferenceClass(mutable, i, true),
|
||||
symbols.reflection.owner.functions.single {
|
||||
it.name.asString() == (if (mutable) "mutableProperty$i" else "property$i")
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user