[tree generator] Make defaultEmptyList#withGetter false by default
to align it with other default* methods. This will be helpful for configuring IR implementation, where there are many such empty lists.
This commit is contained in:
committed by
Space Team
parent
5d7a5245ff
commit
665bd5153a
+4
-4
@@ -73,7 +73,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun ImplementationContext.commonAnnotationConfig() {
|
fun ImplementationContext.commonAnnotationConfig() {
|
||||||
defaultEmptyList("annotations")
|
defaultEmptyList("annotations", withGetter = true)
|
||||||
default("coneTypeOrNull") {
|
default("coneTypeOrNull") {
|
||||||
value = "annotationTypeRef.coneTypeOrNull"
|
value = "annotationTypeRef.coneTypeOrNull"
|
||||||
withGetter = true
|
withGetter = true
|
||||||
@@ -203,8 +203,8 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
|||||||
|
|
||||||
val emptyExpressionBlock = impl(block, "FirEmptyExpressionBlock") {
|
val emptyExpressionBlock = impl(block, "FirEmptyExpressionBlock") {
|
||||||
noSource()
|
noSource()
|
||||||
defaultEmptyList("statements")
|
defaultEmptyList("statements", withGetter = true)
|
||||||
defaultEmptyList("annotations")
|
defaultEmptyList("annotations", withGetter = true)
|
||||||
publicImplementation()
|
publicImplementation()
|
||||||
defaultNull("coneTypeOrNull")
|
defaultNull("coneTypeOrNull")
|
||||||
}
|
}
|
||||||
@@ -635,7 +635,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
|||||||
"typeParameters",
|
"typeParameters",
|
||||||
implementationPredicate = { it.typeName in implementationsWithoutStatusAndTypeParameters }
|
implementationPredicate = { it.typeName in implementationsWithoutStatusAndTypeParameters }
|
||||||
) {
|
) {
|
||||||
defaultEmptyList(it)
|
defaultEmptyList(it, withGetter = true)
|
||||||
additionalImports(resolvedDeclarationStatusImplType)
|
additionalImports(resolvedDeclarationStatusImplType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -244,16 +244,16 @@ abstract class AbstractImplementationConfigurator<Implementation, Element, Imple
|
|||||||
/**
|
/**
|
||||||
* Specifies that the default value of each field of [fields] in this implementation class should be [emptyList].
|
* Specifies that the default value of each field of [fields] in this implementation class should be [emptyList].
|
||||||
*
|
*
|
||||||
* Always forces generation of a getter-only computed property.
|
* @param withGetter If `true`, the field will be generated as a computed property instead of stored one.
|
||||||
*/
|
*/
|
||||||
fun defaultEmptyList(vararg fields: String) {
|
fun defaultEmptyList(vararg fields: String, withGetter: Boolean = false) {
|
||||||
for (field in fields) {
|
for (field in fields) {
|
||||||
require(getField(field).origin is ListField) {
|
require(getField(field).origin is ListField) {
|
||||||
"$field is list field"
|
"$field is list field"
|
||||||
}
|
}
|
||||||
default(field) {
|
default(field) {
|
||||||
value = "emptyList()"
|
value = "emptyList()"
|
||||||
withGetter = true
|
this.withGetter = withGetter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user