FIR: Add new nodes kind for comparison operator

^KT-31163 In Progress
This commit is contained in:
Denis Zharkov
2020-02-26 16:39:05 +03:00
parent 3ecee5c7cd
commit 80b7fbd07a
9 changed files with 163 additions and 1 deletions
@@ -79,6 +79,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val call = element("Call", Expression, statement) // TODO: may smth like `CallWithArguments` or `ElementWithArguments`?
val annotationCall = element("AnnotationCall", Expression, expression, call)
val operatorCall = element("OperatorCall", Expression, expression, call)
val comparisonExpression = element("ComparisonExpression", Expression, expression)
val typeOperatorCall = element("TypeOperatorCall", Expression, expression, call)
val whenExpression = element("WhenExpression", Expression, expression, resolvable)
val whenBranch = element("WhenBranch", Expression)
@@ -140,4 +141,4 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val composedSuperTypeRef = element("ComposedSuperTypeRef", TypeRef, typeRef)
val contractDescription = element("ContractDescription", Contracts)
}
}
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.tree.generator
import org.jetbrains.kotlin.fir.tree.generator.context.AbstractFirTreeImplementationConfigurator
import org.jetbrains.kotlin.fir.tree.generator.model.Implementation.Kind.Object
import org.jetbrains.kotlin.fir.tree.generator.model.Implementation.Kind.OpenClass
import org.jetbrains.kotlin.fir.tree.generator.model.Type
object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator() {
fun configureImplementations() {
@@ -241,6 +242,11 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
useTypes(implicitTypeRefType, implicitBooleanTypeRefType)
}
impl(comparisonExpression) {
default("typeRef", "FirImplicitBooleanTypeRef(null)")
useTypes(implicitBooleanTypeRefType)
}
impl(typeOperatorCall)
impl(resolvedQualifier) {
@@ -185,6 +185,11 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+field("operation", operationType)
}
comparisonExpression.configure {
+field("operation", operationType)
+field("compareToCall", functionCall)
}
typeOperatorCall.configure {
+field("operation", operationType)
+field("conversionTypeRef", typeRef)