[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) {
|
if (operation in FirOperation.ASSIGNMENTS && operation != FirOperation.ASSIGN) {
|
||||||
return buildOperatorCall {
|
return buildAssignmentOperatorStatement {
|
||||||
source = baseSource
|
source = baseSource
|
||||||
this.operation = operation
|
this.operation = operation
|
||||||
// TODO: take good psi
|
// TODO: take good psi
|
||||||
argumentList = buildBinaryArgumentList(
|
leftArgument = this@generateAssignment?.convert() ?: buildErrorExpression {
|
||||||
this@generateAssignment?.convert() ?: buildErrorExpression {
|
source = null
|
||||||
source = null
|
diagnostic = ConeSimpleDiagnostic(
|
||||||
diagnostic = ConeSimpleDiagnostic(
|
"Unsupported left value of assignment: ${baseSource?.psi?.text}", DiagnosticKind.ExpressionRequired
|
||||||
"Unsupported left value of assignment: ${baseSource?.psi?.text}", DiagnosticKind.ExpressionRequired
|
)
|
||||||
)
|
}
|
||||||
},
|
rightArgument = value
|
||||||
value
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require(operation == FirOperation.ASSIGN)
|
require(operation == FirOperation.ASSIGN)
|
||||||
|
|||||||
+2
-2
@@ -270,7 +270,7 @@ class ExpressionsConverter(
|
|||||||
if (firOperation in FirOperation.ASSIGNMENTS) {
|
if (firOperation in FirOperation.ASSIGNMENTS) {
|
||||||
return leftArgNode.generateAssignment(binaryExpression.toFirSourceElement(), rightArg, rightArgAsFir, firOperation) { getAsFirExpression(this) }
|
return leftArgNode.generateAssignment(binaryExpression.toFirSourceElement(), rightArg, rightArgAsFir, firOperation) { getAsFirExpression(this) }
|
||||||
} else {
|
} else {
|
||||||
buildOperatorCall {
|
buildEqualityOperatorCall {
|
||||||
source = binaryExpression.toFirSourceElement()
|
source = binaryExpression.toFirSourceElement()
|
||||||
operation = firOperation
|
operation = firOperation
|
||||||
argumentList = buildBinaryArgumentList(leftArgAsFir, rightArgAsFir)
|
argumentList = buildBinaryArgumentList(leftArgAsFir, rightArgAsFir)
|
||||||
@@ -704,7 +704,7 @@ class ExpressionsConverter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return if (whenRefWithSubject != null) {
|
return if (whenRefWithSubject != null) {
|
||||||
buildOperatorCall {
|
buildEqualityOperatorCall {
|
||||||
source = whenCondition.toFirSourceElement()
|
source = whenCondition.toFirSourceElement()
|
||||||
operation = FirOperation.EQ
|
operation = FirOperation.EQ
|
||||||
argumentList = buildBinaryArgumentList(
|
argumentList = buildBinaryArgumentList(
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ internal fun KtWhenCondition.toFirWhenCondition(
|
|||||||
}
|
}
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is KtWhenConditionWithExpression -> {
|
is KtWhenConditionWithExpression -> {
|
||||||
buildOperatorCall {
|
buildEqualityOperatorCall {
|
||||||
source = expression?.toFirPsiSourceElement(FirFakeSourceElementKind.WhenCondition)
|
source = expression?.toFirPsiSourceElement(FirFakeSourceElementKind.WhenCondition)
|
||||||
operation = FirOperation.EQ
|
operation = FirOperation.EQ
|
||||||
argumentList = buildBinaryArgumentList(
|
argumentList = buildBinaryArgumentList(
|
||||||
|
|||||||
@@ -1632,7 +1632,7 @@ class RawFirBuilder(
|
|||||||
(this as KtExpression).toFirExpression("Incorrect expression in assignment: ${expression.text}")
|
(this as KtExpression).toFirExpression("Incorrect expression in assignment: ${expression.text}")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buildOperatorCall {
|
buildEqualityOperatorCall {
|
||||||
this.source = source
|
this.source = source
|
||||||
operation = firOperation
|
operation = firOperation
|
||||||
argumentList = buildBinaryArgumentList(leftArgument, rightArgument)
|
argumentList = buildBinaryArgumentList(leftArgument, rightArgument)
|
||||||
|
|||||||
Reference in New Issue
Block a user