Add withBindThis to field configuration

This commit is contained in:
Nikolay Lunyak
2021-07-26 15:58:32 +03:00
committed by Space
parent 4003cd2832
commit a44048e713
3 changed files with 13 additions and 4 deletions
@@ -289,7 +289,9 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
typeParameter.configure {
+name
+symbol("FirTypeParameterSymbol")
+field("containingDeclarationSymbol", firBasedSymbolType, "*", nullable = true)
+field("containingDeclarationSymbol", firBasedSymbolType, "*", nullable = true).apply {
withBindThis = false
}
+field(varianceType)
+booleanField("isReified")
+fieldList("bounds", typeRef, withReplace = true)
@@ -28,6 +28,8 @@ sealed class Field : Importable {
open val overridenTypes: MutableSet<Importable> = mutableSetOf()
open var useNullableForReplace: Boolean = false
var withBindThis = true
fun copy(): Field = internalCopy().also {
updateFieldsInCopy(it)
}
@@ -137,7 +139,9 @@ class SimpleField(
customType,
nullable,
withReplace
)
).apply {
withBindThis = this@SimpleField.withBindThis
}
}
fun replaceType(newType: Type) = SimpleField(
@@ -148,6 +152,7 @@ class SimpleField(
nullable,
withReplace
).also {
it.withBindThis = withBindThis
updateFieldsInCopy(it)
}
}
@@ -176,7 +181,9 @@ class FirField(
element,
nullable,
withReplace
)
).apply {
withBindThis = this@FirField.withBindThis
}
}
}
@@ -103,7 +103,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
element.allFields.filter {
it.name != "containingDeclarationSymbol" && it.type.contains("Symbol") && it !is FieldList
it.withBindThis && it.type.contains("Symbol") && it !is FieldList
}.takeIf {
it.isNotEmpty() && !isInterface && !isAbstract &&
!element.type.contains("Reference")