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 { typeParameter.configure {
+name +name
+symbol("FirTypeParameterSymbol") +symbol("FirTypeParameterSymbol")
+field("containingDeclarationSymbol", firBasedSymbolType, "*", nullable = true) +field("containingDeclarationSymbol", firBasedSymbolType, "*", nullable = true).apply {
withBindThis = false
}
+field(varianceType) +field(varianceType)
+booleanField("isReified") +booleanField("isReified")
+fieldList("bounds", typeRef, withReplace = true) +fieldList("bounds", typeRef, withReplace = true)
@@ -28,6 +28,8 @@ sealed class Field : Importable {
open val overridenTypes: MutableSet<Importable> = mutableSetOf() open val overridenTypes: MutableSet<Importable> = mutableSetOf()
open var useNullableForReplace: Boolean = false open var useNullableForReplace: Boolean = false
var withBindThis = true
fun copy(): Field = internalCopy().also { fun copy(): Field = internalCopy().also {
updateFieldsInCopy(it) updateFieldsInCopy(it)
} }
@@ -137,7 +139,9 @@ class SimpleField(
customType, customType,
nullable, nullable,
withReplace withReplace
) ).apply {
withBindThis = this@SimpleField.withBindThis
}
} }
fun replaceType(newType: Type) = SimpleField( fun replaceType(newType: Type) = SimpleField(
@@ -148,6 +152,7 @@ class SimpleField(
nullable, nullable,
withReplace withReplace
).also { ).also {
it.withBindThis = withBindThis
updateFieldsInCopy(it) updateFieldsInCopy(it)
} }
} }
@@ -176,7 +181,9 @@ class FirField(
element, element,
nullable, nullable,
withReplace withReplace
) ).apply {
withBindThis = this@FirField.withBindThis
}
} }
} }
@@ -103,7 +103,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
element.allFields.filter { element.allFields.filter {
it.name != "containingDeclarationSymbol" && it.type.contains("Symbol") && it !is FieldList it.withBindThis && it.type.contains("Symbol") && it !is FieldList
}.takeIf { }.takeIf {
it.isNotEmpty() && !isInterface && !isAbstract && it.isNotEmpty() && !isInterface && !isAbstract &&
!element.type.contains("Reference") !element.type.contains("Reference")