Remove FirElement.session usages from RawFirBuilder & around
Related to KT-30187
This commit is contained in:
@@ -175,7 +175,7 @@ internal fun IElementType.toFirOperation(): FirOperation =
|
|||||||
else -> throw AssertionError(this.toString())
|
else -> throw AssertionError(this.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun FirExpression.generateNotNullOrOther(other: FirExpression, caseId: String, basePsi: KtElement): FirWhenExpression {
|
internal fun FirExpression.generateNotNullOrOther(session: FirSession, other: FirExpression, caseId: String, basePsi: KtElement): FirWhenExpression {
|
||||||
val subjectName = Name.special("<$caseId>")
|
val subjectName = Name.special("<$caseId>")
|
||||||
val subjectVariable = generateTemporaryVariable(session, psi, subjectName, this)
|
val subjectVariable = generateTemporaryVariable(session, psi, subjectName, this)
|
||||||
val subjectExpression = FirWhenSubjectExpression(session, psi)
|
val subjectExpression = FirWhenSubjectExpression(session, psi)
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
|
|
||||||
private fun FirExpression.toReturn(basePsi: PsiElement? = psi, labelName: String? = null): FirReturnExpression {
|
private fun FirExpression.toReturn(basePsi: PsiElement? = psi, labelName: String? = null): FirReturnExpression {
|
||||||
return FirReturnExpressionImpl(
|
return FirReturnExpressionImpl(
|
||||||
session,
|
this@RawFirBuilder.session,
|
||||||
basePsi,
|
basePsi,
|
||||||
this
|
this
|
||||||
).apply {
|
).apply {
|
||||||
@@ -131,7 +131,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
if (lastFunction != null) {
|
if (lastFunction != null) {
|
||||||
target.bind(lastFunction)
|
target.bind(lastFunction)
|
||||||
} else {
|
} else {
|
||||||
target.bind(FirErrorFunction(session, psi, "Cannot bind unlabeled return to a function"))
|
target.bind(FirErrorFunction(this@RawFirBuilder.session, psi, "Cannot bind unlabeled return to a function"))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (firFunction in firFunctions.asReversed()) {
|
for (firFunction in firFunctions.asReversed()) {
|
||||||
@@ -150,7 +150,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
target.bind(FirErrorFunction(session, psi, "Cannot bind label $labelName to a function"))
|
target.bind(FirErrorFunction(this@RawFirBuilder.session, psi, "Cannot bind label $labelName to a function"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -598,12 +598,12 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
val multiDeclaration = valueParameter.destructuringDeclaration
|
val multiDeclaration = valueParameter.destructuringDeclaration
|
||||||
valueParameters += if (multiDeclaration != null) {
|
valueParameters += if (multiDeclaration != null) {
|
||||||
val multiParameter = FirValueParameterImpl(
|
val multiParameter = FirValueParameterImpl(
|
||||||
session, valueParameter, Name.special("<destruct>"),
|
this@RawFirBuilder.session, valueParameter, Name.special("<destruct>"),
|
||||||
FirImplicitTypeRefImpl(session, multiDeclaration),
|
FirImplicitTypeRefImpl(this@RawFirBuilder.session, multiDeclaration),
|
||||||
defaultValue = null, isCrossinline = false, isNoinline = false, isVararg = false
|
defaultValue = null, isCrossinline = false, isNoinline = false, isVararg = false
|
||||||
)
|
)
|
||||||
destructuringBlock = generateDestructuringBlock(
|
destructuringBlock = generateDestructuringBlock(
|
||||||
session, multiDeclaration, multiParameter, { extractAnnotationsTo(it) }
|
this@RawFirBuilder.session, multiDeclaration, multiParameter, { extractAnnotationsTo(it) }
|
||||||
) { toFirOrImplicitType() }
|
) { toFirOrImplicitType() }
|
||||||
multiParameter
|
multiParameter
|
||||||
} else {
|
} else {
|
||||||
@@ -611,7 +611,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
label = firLabels.pop() ?: firFunctionCalls.lastOrNull()?.calleeReference?.name?.let {
|
label = firLabels.pop() ?: firFunctionCalls.lastOrNull()?.calleeReference?.name?.let {
|
||||||
FirLabelImpl(session, expression, it.asString())
|
FirLabelImpl(this@RawFirBuilder.session, expression, it.asString())
|
||||||
}
|
}
|
||||||
val bodyExpression = literal.bodyExpression.toFirExpression("Lambda has no body")
|
val bodyExpression = literal.bodyExpression.toFirExpression("Lambda has no body")
|
||||||
if (destructuringBlock is FirBlock && bodyExpression is FirBlockImpl) {
|
if (destructuringBlock is FirBlock && bodyExpression is FirBlockImpl) {
|
||||||
@@ -619,7 +619,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
bodyExpression.statements.add(index, statement)
|
bodyExpression.statements.add(index, statement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body = FirSingleExpressionBlock(session, bodyExpression.toReturn())
|
body = FirSingleExpressionBlock(this@RawFirBuilder.session, bodyExpression.toReturn())
|
||||||
|
|
||||||
firFunctions.removeLast()
|
firFunctions.removeLast()
|
||||||
}
|
}
|
||||||
@@ -867,16 +867,16 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
var hasExpressions = false
|
var hasExpressions = false
|
||||||
val interpolatingCall = FirFunctionCallImpl(session, expression).apply {
|
val interpolatingCall = FirFunctionCallImpl(session, expression).apply {
|
||||||
calleeReference = FirSimpleNamedReference(session, expression, OperatorNameConventions.PLUS)
|
calleeReference = FirSimpleNamedReference(this@RawFirBuilder.session, expression, OperatorNameConventions.PLUS)
|
||||||
for (entry in expression.entries) {
|
for (entry in expression.entries) {
|
||||||
when (entry) {
|
when (entry) {
|
||||||
is KtLiteralStringTemplateEntry -> {
|
is KtLiteralStringTemplateEntry -> {
|
||||||
sb.append(entry.text)
|
sb.append(entry.text)
|
||||||
arguments += FirConstExpressionImpl(session, entry, IrConstKind.String, entry.text)
|
arguments += FirConstExpressionImpl(this@RawFirBuilder.session, entry, IrConstKind.String, entry.text)
|
||||||
}
|
}
|
||||||
is KtEscapeStringTemplateEntry -> {
|
is KtEscapeStringTemplateEntry -> {
|
||||||
sb.append(entry.unescapedValue)
|
sb.append(entry.unescapedValue)
|
||||||
arguments += FirConstExpressionImpl(session, entry, IrConstKind.String, entry.unescapedValue)
|
arguments += FirConstExpressionImpl(this@RawFirBuilder.session, entry, IrConstKind.String, entry.unescapedValue)
|
||||||
}
|
}
|
||||||
is KtStringTemplateEntryWithExpression -> {
|
is KtStringTemplateEntryWithExpression -> {
|
||||||
val innerExpression = entry.expression
|
val innerExpression = entry.expression
|
||||||
@@ -886,7 +886,9 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
arguments += FirErrorExpressionImpl(session, expression, "Incorrect template entry: ${entry.text}")
|
arguments += FirErrorExpressionImpl(
|
||||||
|
this@RawFirBuilder.session, expression, "Incorrect template entry: ${entry.text}"
|
||||||
|
)
|
||||||
hasExpressions = true
|
hasExpressions = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -912,7 +914,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
for (clause in expression.catchClauses) {
|
for (clause in expression.catchClauses) {
|
||||||
val parameter = clause.catchParameter?.toFirValueParameter() ?: continue
|
val parameter = clause.catchParameter?.toFirValueParameter() ?: continue
|
||||||
val block = clause.catchBody.toFirBlock()
|
val block = clause.catchBody.toFirBlock()
|
||||||
catches += FirCatchImpl(session, clause, parameter, block)
|
catches += FirCatchImpl(this@RawFirBuilder.session, clause, parameter, block)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -925,9 +927,11 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
val condition = expression.condition
|
val condition = expression.condition
|
||||||
val firCondition = condition.toFirExpression("If statement should have condition")
|
val firCondition = condition.toFirExpression("If statement should have condition")
|
||||||
val trueBranch = expression.then.toFirBlock()
|
val trueBranch = expression.then.toFirBlock()
|
||||||
branches += FirWhenBranchImpl(session, condition, firCondition, trueBranch)
|
branches += FirWhenBranchImpl(this@RawFirBuilder.session, condition, firCondition, trueBranch)
|
||||||
val elseBranch = expression.`else`.toFirBlock()
|
val elseBranch = expression.`else`.toFirBlock()
|
||||||
branches += FirWhenBranchImpl(session, null, FirElseIfTrueCondition(session, null), elseBranch)
|
branches += FirWhenBranchImpl(
|
||||||
|
this@RawFirBuilder.session, null, FirElseIfTrueCondition(this@RawFirBuilder.session, null), elseBranch
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -994,28 +998,32 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
if (hasSubject) {
|
if (hasSubject) {
|
||||||
var firCondition: FirExpression? = null
|
var firCondition: FirExpression? = null
|
||||||
for (condition in entry.conditions) {
|
for (condition in entry.conditions) {
|
||||||
val firConditionElement = condition.toFirWhenCondition(FirWhenSubjectExpression(session, condition))
|
val firConditionElement = condition.toFirWhenCondition(
|
||||||
|
FirWhenSubjectExpression(this@RawFirBuilder.session, condition)
|
||||||
|
)
|
||||||
when {
|
when {
|
||||||
firCondition == null -> firCondition = firConditionElement
|
firCondition == null -> firCondition = firConditionElement
|
||||||
firCondition is FirOperatorCallImpl && firCondition.operation == FirOperation.OR -> {
|
firCondition is FirOperatorCallImpl && firCondition.operation == FirOperation.OR -> {
|
||||||
firCondition.arguments += firConditionElement
|
firCondition.arguments += firConditionElement
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
firCondition = FirOperatorCallImpl(session, entry, FirOperation.OR).apply {
|
firCondition = FirOperatorCallImpl(this@RawFirBuilder.session, entry, FirOperation.OR).apply {
|
||||||
arguments += firCondition!!
|
arguments += firCondition!!
|
||||||
arguments += firConditionElement
|
arguments += firConditionElement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FirWhenBranchImpl(session, entry, firCondition!!, branch)
|
FirWhenBranchImpl(this@RawFirBuilder.session, entry, firCondition!!, branch)
|
||||||
} else {
|
} else {
|
||||||
val condition = entry.conditions.first() as? KtWhenConditionWithExpression
|
val condition = entry.conditions.first() as? KtWhenConditionWithExpression
|
||||||
val firCondition = condition?.expression.toFirExpression("No expression in condition with expression")
|
val firCondition = condition?.expression.toFirExpression("No expression in condition with expression")
|
||||||
FirWhenBranchImpl(session, entry, firCondition, branch)
|
FirWhenBranchImpl(this@RawFirBuilder.session, entry, firCondition, branch)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FirWhenBranchImpl(session, entry, FirElseIfTrueCondition(session, null), branch)
|
FirWhenBranchImpl(
|
||||||
|
this@RawFirBuilder.session, entry, FirElseIfTrueCondition(this@RawFirBuilder.session, null), branch
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1048,42 +1056,42 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
val parameter = expression.loopParameter
|
val parameter = expression.loopParameter
|
||||||
return FirBlockImpl(session, expression).apply {
|
return FirBlockImpl(session, expression).apply {
|
||||||
val rangeName = Name.special("<range>")
|
val rangeName = Name.special("<range>")
|
||||||
statements += generateTemporaryVariable(session, expression.loopRange, rangeName, rangeExpression)
|
statements += generateTemporaryVariable(this@RawFirBuilder.session, expression.loopRange, rangeName, rangeExpression)
|
||||||
val iteratorName = Name.special("<iterator>")
|
val iteratorName = Name.special("<iterator>")
|
||||||
statements += generateTemporaryVariable(
|
statements += generateTemporaryVariable(
|
||||||
session, expression.loopRange, iteratorName,
|
this@RawFirBuilder.session, expression.loopRange, iteratorName,
|
||||||
FirFunctionCallImpl(session, expression).apply {
|
FirFunctionCallImpl(this@RawFirBuilder.session, expression).apply {
|
||||||
calleeReference = FirSimpleNamedReference(session, expression, Name.identifier("iterator"))
|
calleeReference = FirSimpleNamedReference(this@RawFirBuilder.session, expression, Name.identifier("iterator"))
|
||||||
explicitReceiver = generateAccessExpression(session, expression.loopRange, rangeName)
|
explicitReceiver = generateAccessExpression(this@RawFirBuilder.session, expression.loopRange, rangeName)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
statements += FirWhileLoopImpl(
|
statements += FirWhileLoopImpl(
|
||||||
session, expression,
|
this@RawFirBuilder.session, expression,
|
||||||
FirFunctionCallImpl(session, expression).apply {
|
FirFunctionCallImpl(this@RawFirBuilder.session, expression).apply {
|
||||||
calleeReference = FirSimpleNamedReference(session, expression, Name.identifier("hasNext"))
|
calleeReference = FirSimpleNamedReference(this@RawFirBuilder.session, expression, Name.identifier("hasNext"))
|
||||||
explicitReceiver = generateAccessExpression(session, expression, iteratorName)
|
explicitReceiver = generateAccessExpression(this@RawFirBuilder.session, expression, iteratorName)
|
||||||
}
|
}
|
||||||
).configure {
|
).configure {
|
||||||
val body = expression.body
|
val body = expression.body
|
||||||
// NB: just body.toFirBlock() isn't acceptable here because we need to add some statements
|
// NB: just body.toFirBlock() isn't acceptable here because we need to add some statements
|
||||||
val block = when (body) {
|
val block = when (body) {
|
||||||
is KtBlockExpression -> body.accept(this@Visitor, Unit) as FirBlockImpl
|
is KtBlockExpression -> body.accept(this@Visitor, Unit) as FirBlockImpl
|
||||||
null -> FirBlockImpl(session, body)
|
null -> FirBlockImpl(this@RawFirBuilder.session, body)
|
||||||
else -> FirBlockImpl(session, body).apply { statements += body.toFirStatement() }
|
else -> FirBlockImpl(this@RawFirBuilder.session, body).apply { statements += body.toFirStatement() }
|
||||||
}
|
}
|
||||||
if (parameter != null) {
|
if (parameter != null) {
|
||||||
val multiDeclaration = parameter.destructuringDeclaration
|
val multiDeclaration = parameter.destructuringDeclaration
|
||||||
val firLoopParameter = generateTemporaryVariable(
|
val firLoopParameter = generateTemporaryVariable(
|
||||||
session, expression.loopParameter,
|
this@RawFirBuilder.session, expression.loopParameter,
|
||||||
if (multiDeclaration != null) Name.special("<destruct>") else parameter.nameAsSafeName,
|
if (multiDeclaration != null) Name.special("<destruct>") else parameter.nameAsSafeName,
|
||||||
FirFunctionCallImpl(session, expression).apply {
|
FirFunctionCallImpl(this@RawFirBuilder.session, expression).apply {
|
||||||
calleeReference = FirSimpleNamedReference(session, expression, Name.identifier("next"))
|
calleeReference = FirSimpleNamedReference(this@RawFirBuilder.session, expression, Name.identifier("next"))
|
||||||
explicitReceiver = generateAccessExpression(session, expression, iteratorName)
|
explicitReceiver = generateAccessExpression(this@RawFirBuilder.session, expression, iteratorName)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (multiDeclaration != null) {
|
if (multiDeclaration != null) {
|
||||||
val destructuringBlock = generateDestructuringBlock(
|
val destructuringBlock = generateDestructuringBlock(
|
||||||
session, multiDeclaration, firLoopParameter, { extractAnnotationsTo(it) }
|
this@RawFirBuilder.session, multiDeclaration, firLoopParameter, { extractAnnotationsTo(it) }
|
||||||
) { toFirOrImplicitType() }
|
) { toFirOrImplicitType() }
|
||||||
if (destructuringBlock is FirBlock) {
|
if (destructuringBlock is FirBlock) {
|
||||||
for ((index, statement) in destructuringBlock.statements.withIndex()) {
|
for ((index, statement) in destructuringBlock.statements.withIndex()) {
|
||||||
@@ -1107,7 +1115,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
if (lastLoop != null) {
|
if (lastLoop != null) {
|
||||||
target.bind(lastLoop)
|
target.bind(lastLoop)
|
||||||
} else {
|
} else {
|
||||||
target.bind(FirErrorLoop(session, psi, "Cannot bind unlabeled jump to a loop"))
|
target.bind(FirErrorLoop(this@RawFirBuilder.session, psi, "Cannot bind unlabeled jump to a loop"))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (firLoop in firLoops.asReversed()) {
|
for (firLoop in firLoops.asReversed()) {
|
||||||
@@ -1116,7 +1124,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
target.bind(FirErrorLoop(session, psi, "Cannot bind label $labelName to a loop"))
|
target.bind(FirErrorLoop(this@RawFirBuilder.session, psi, "Cannot bind label $labelName to a loop"))
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
@@ -1132,14 +1140,15 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
private fun KtBinaryExpression.elvisToWhen(): FirWhenExpression {
|
private fun KtBinaryExpression.elvisToWhen(): FirWhenExpression {
|
||||||
val rightArgument = right.toFirExpression("No right operand")
|
val rightArgument = right.toFirExpression("No right operand")
|
||||||
val leftArgument = left.toFirExpression("No left operand")
|
val leftArgument = left.toFirExpression("No left operand")
|
||||||
return leftArgument.generateNotNullOrOther(rightArgument, "elvis", this)
|
return leftArgument.generateNotNullOrOther(session, rightArgument, "elvis", this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun KtUnaryExpression.bangBangToWhen(): FirWhenExpression {
|
private fun KtUnaryExpression.bangBangToWhen(): FirWhenExpression {
|
||||||
return baseExpression.toFirExpression("No operand").generateNotNullOrOther(
|
return baseExpression.toFirExpression("No operand").generateNotNullOrOther(
|
||||||
|
session,
|
||||||
FirThrowExpressionImpl(
|
FirThrowExpressionImpl(
|
||||||
session, this, FirFunctionCallImpl(session, this).apply {
|
session, this, FirFunctionCallImpl(session, this).apply {
|
||||||
calleeReference = FirSimpleNamedReference(session, this@bangBangToWhen, KNPE)
|
calleeReference = FirSimpleNamedReference(this@RawFirBuilder.session, this@bangBangToWhen, KNPE)
|
||||||
}
|
}
|
||||||
), "bangbang", this
|
), "bangbang", this
|
||||||
)
|
)
|
||||||
@@ -1157,7 +1166,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
session, expression
|
session, expression
|
||||||
).apply {
|
).apply {
|
||||||
calleeReference = FirSimpleNamedReference(
|
calleeReference = FirSimpleNamedReference(
|
||||||
session, expression.operationReference,
|
this@RawFirBuilder.session, expression.operationReference,
|
||||||
conventionCallName ?: expression.operationReference.getReferencedNameAsName()
|
conventionCallName ?: expression.operationReference.getReferencedNameAsName()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1213,7 +1222,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
session, expression
|
session, expression
|
||||||
).apply {
|
).apply {
|
||||||
calleeReference = FirSimpleNamedReference(
|
calleeReference = FirSimpleNamedReference(
|
||||||
session, expression.operationReference, conventionCallName
|
this@RawFirBuilder.session, expression.operationReference, conventionCallName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1233,15 +1242,15 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
return FirFunctionCallImpl(session, expression).apply {
|
return FirFunctionCallImpl(session, expression).apply {
|
||||||
val calleeReference = when (calleeExpression) {
|
val calleeReference = when (calleeExpression) {
|
||||||
is KtSimpleNameExpression -> FirSimpleNamedReference(
|
is KtSimpleNameExpression -> FirSimpleNamedReference(
|
||||||
session, calleeExpression, calleeExpression.getReferencedNameAsName()
|
this@RawFirBuilder.session, calleeExpression, calleeExpression.getReferencedNameAsName()
|
||||||
)
|
)
|
||||||
null -> FirErrorNamedReference(
|
null -> FirErrorNamedReference(
|
||||||
session, calleeExpression, "Call has no callee"
|
this@RawFirBuilder.session, calleeExpression, "Call has no callee"
|
||||||
)
|
)
|
||||||
else -> {
|
else -> {
|
||||||
arguments += calleeExpression.toFirExpression("Incorrect invoke receiver")
|
arguments += calleeExpression.toFirExpression("Incorrect invoke receiver")
|
||||||
FirSimpleNamedReference(
|
FirSimpleNamedReference(
|
||||||
session, expression, OperatorNameConventions.INVOKE
|
this@RawFirBuilder.session, expression, OperatorNameConventions.INVOKE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1278,14 +1287,14 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
override fun visitThisExpression(expression: KtThisExpression, data: Unit): FirElement {
|
override fun visitThisExpression(expression: KtThisExpression, data: Unit): FirElement {
|
||||||
val labelName = expression.getLabelName()
|
val labelName = expression.getLabelName()
|
||||||
return FirQualifiedAccessExpressionImpl(session, expression).apply {
|
return FirQualifiedAccessExpressionImpl(session, expression).apply {
|
||||||
calleeReference = FirExplicitThisReference(session, expression, labelName)
|
calleeReference = FirExplicitThisReference(this@RawFirBuilder.session, expression, labelName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitSuperExpression(expression: KtSuperExpression, data: Unit): FirElement {
|
override fun visitSuperExpression(expression: KtSuperExpression, data: Unit): FirElement {
|
||||||
val superType = expression.superTypeQualifier
|
val superType = expression.superTypeQualifier
|
||||||
return FirQualifiedAccessExpressionImpl(session, expression).apply {
|
return FirQualifiedAccessExpressionImpl(session, expression).apply {
|
||||||
calleeReference = FirExplicitSuperReference(session, expression, superType.toFirOrImplicitType())
|
calleeReference = FirExplicitSuperReference(this@RawFirBuilder.session, expression, superType.toFirOrImplicitType())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1340,7 +1349,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
|||||||
override fun visitCallableReferenceExpression(expression: KtCallableReferenceExpression, data: Unit): FirElement {
|
override fun visitCallableReferenceExpression(expression: KtCallableReferenceExpression, data: Unit): FirElement {
|
||||||
return FirCallableReferenceAccessImpl(session, expression).apply {
|
return FirCallableReferenceAccessImpl(session, expression).apply {
|
||||||
calleeReference = FirSimpleNamedReference(
|
calleeReference = FirSimpleNamedReference(
|
||||||
session, expression.callableReference, expression.callableReference.getReferencedNameAsName()
|
this@RawFirBuilder.session, expression.callableReference, expression.callableReference.getReferencedNameAsName()
|
||||||
)
|
)
|
||||||
explicitReceiver = expression.receiverExpression?.toFirExpression("Incorrect receiver expression")
|
explicitReceiver = expression.receiverExpression?.toFirExpression("Incorrect receiver expression")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user