[FIR] Change fir builder to use newly created nodes
This commit is contained in:
+8
-10
@@ -530,19 +530,17 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
}
|
||||
|
||||
if (operation in FirOperation.ASSIGNMENTS && operation != FirOperation.ASSIGN) {
|
||||
return buildOperatorCall {
|
||||
return buildAssignmentOperatorStatement {
|
||||
source = baseSource
|
||||
this.operation = operation
|
||||
// TODO: take good psi
|
||||
argumentList = buildBinaryArgumentList(
|
||||
this@generateAssignment?.convert() ?: buildErrorExpression {
|
||||
source = null
|
||||
diagnostic = ConeSimpleDiagnostic(
|
||||
"Unsupported left value of assignment: ${baseSource?.psi?.text}", DiagnosticKind.ExpressionRequired
|
||||
)
|
||||
},
|
||||
value
|
||||
)
|
||||
leftArgument = this@generateAssignment?.convert() ?: buildErrorExpression {
|
||||
source = null
|
||||
diagnostic = ConeSimpleDiagnostic(
|
||||
"Unsupported left value of assignment: ${baseSource?.psi?.text}", DiagnosticKind.ExpressionRequired
|
||||
)
|
||||
}
|
||||
rightArgument = value
|
||||
}
|
||||
}
|
||||
require(operation == FirOperation.ASSIGN)
|
||||
|
||||
+2
-2
@@ -270,7 +270,7 @@ class ExpressionsConverter(
|
||||
if (firOperation in FirOperation.ASSIGNMENTS) {
|
||||
return leftArgNode.generateAssignment(binaryExpression.toFirSourceElement(), rightArg, rightArgAsFir, firOperation) { getAsFirExpression(this) }
|
||||
} else {
|
||||
buildOperatorCall {
|
||||
buildEqualityOperatorCall {
|
||||
source = binaryExpression.toFirSourceElement()
|
||||
operation = firOperation
|
||||
argumentList = buildBinaryArgumentList(leftArgAsFir, rightArgAsFir)
|
||||
@@ -704,7 +704,7 @@ class ExpressionsConverter(
|
||||
}
|
||||
}
|
||||
return if (whenRefWithSubject != null) {
|
||||
buildOperatorCall {
|
||||
buildEqualityOperatorCall {
|
||||
source = whenCondition.toFirSourceElement()
|
||||
operation = FirOperation.EQ
|
||||
argumentList = buildBinaryArgumentList(
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ internal fun KtWhenCondition.toFirWhenCondition(
|
||||
}
|
||||
return when (this) {
|
||||
is KtWhenConditionWithExpression -> {
|
||||
buildOperatorCall {
|
||||
buildEqualityOperatorCall {
|
||||
source = expression?.toFirPsiSourceElement(FirFakeSourceElementKind.WhenCondition)
|
||||
operation = FirOperation.EQ
|
||||
argumentList = buildBinaryArgumentList(
|
||||
|
||||
@@ -1632,7 +1632,7 @@ class RawFirBuilder(
|
||||
(this as KtExpression).toFirExpression("Incorrect expression in assignment: ${expression.text}")
|
||||
}
|
||||
} else {
|
||||
buildOperatorCall {
|
||||
buildEqualityOperatorCall {
|
||||
this.source = source
|
||||
operation = firOperation
|
||||
argumentList = buildBinaryArgumentList(leftArgument, rightArgument)
|
||||
|
||||
Reference in New Issue
Block a user