[FIR] Make type of special expressions immutable
This commit is contained in:
committed by
Space Team
parent
8d7c5b375e
commit
a5cff6ae36
+2
-4
@@ -30,7 +30,7 @@ internal class FirBreakExpressionImpl(
|
|||||||
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
||||||
override val target: FirTarget<FirLoop>,
|
override val target: FirTarget<FirLoop>,
|
||||||
) : FirBreakExpression() {
|
) : FirBreakExpression() {
|
||||||
override var coneTypeOrNull: ConeKotlinType? = StandardClassIds.Nothing.constructClassLikeType()
|
override val coneTypeOrNull: ConeKotlinType? = StandardClassIds.Nothing.constructClassLikeType()
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
@@ -46,9 +46,7 @@ internal class FirBreakExpressionImpl(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {
|
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {}
|
||||||
coneTypeOrNull = newConeTypeOrNull
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
||||||
annotations = newAnnotations.toMutableOrEmpty()
|
annotations = newAnnotations.toMutableOrEmpty()
|
||||||
|
|||||||
+2
-4
@@ -30,7 +30,7 @@ internal class FirContinueExpressionImpl(
|
|||||||
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
||||||
override val target: FirTarget<FirLoop>,
|
override val target: FirTarget<FirLoop>,
|
||||||
) : FirContinueExpression() {
|
) : FirContinueExpression() {
|
||||||
override var coneTypeOrNull: ConeKotlinType? = StandardClassIds.Nothing.constructClassLikeType()
|
override val coneTypeOrNull: ConeKotlinType? = StandardClassIds.Nothing.constructClassLikeType()
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
@@ -46,9 +46,7 @@ internal class FirContinueExpressionImpl(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {
|
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {}
|
||||||
coneTypeOrNull = newConeTypeOrNull
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
||||||
annotations = newAnnotations.toMutableOrEmpty()
|
annotations = newAnnotations.toMutableOrEmpty()
|
||||||
|
|||||||
+2
-4
@@ -28,7 +28,7 @@ class FirElseIfTrueCondition @FirImplementationDetail constructor(
|
|||||||
override val source: KtSourceElement?,
|
override val source: KtSourceElement?,
|
||||||
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
||||||
) : FirExpression() {
|
) : FirExpression() {
|
||||||
override var coneTypeOrNull: ConeKotlinType? = StandardClassIds.Boolean.constructClassLikeType()
|
override val coneTypeOrNull: ConeKotlinType? = StandardClassIds.Boolean.constructClassLikeType()
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
@@ -44,9 +44,7 @@ class FirElseIfTrueCondition @FirImplementationDetail constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {
|
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {}
|
||||||
coneTypeOrNull = newConeTypeOrNull
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
||||||
annotations = newAnnotations.toMutableOrEmpty()
|
annotations = newAnnotations.toMutableOrEmpty()
|
||||||
|
|||||||
+2
-4
@@ -32,7 +32,7 @@ internal class FirReturnExpressionImpl(
|
|||||||
override val target: FirTarget<FirFunction>,
|
override val target: FirTarget<FirFunction>,
|
||||||
override var result: FirExpression,
|
override var result: FirExpression,
|
||||||
) : FirReturnExpression() {
|
) : FirReturnExpression() {
|
||||||
override var coneTypeOrNull: ConeKotlinType? = StandardClassIds.Nothing.constructClassLikeType()
|
override val coneTypeOrNull: ConeKotlinType? = StandardClassIds.Nothing.constructClassLikeType()
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
@@ -60,9 +60,7 @@ internal class FirReturnExpressionImpl(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {
|
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {}
|
||||||
coneTypeOrNull = newConeTypeOrNull
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
||||||
annotations = newAnnotations.toMutableOrEmpty()
|
annotations = newAnnotations.toMutableOrEmpty()
|
||||||
|
|||||||
+2
-4
@@ -29,7 +29,7 @@ internal class FirStringConcatenationCallImpl(
|
|||||||
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
||||||
override var argumentList: FirArgumentList,
|
override var argumentList: FirArgumentList,
|
||||||
) : FirStringConcatenationCall() {
|
) : FirStringConcatenationCall() {
|
||||||
override var coneTypeOrNull: ConeKotlinType? = StandardClassIds.String.constructClassLikeType()
|
override val coneTypeOrNull: ConeKotlinType? = StandardClassIds.String.constructClassLikeType()
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
@@ -55,7 +55,5 @@ internal class FirStringConcatenationCallImpl(
|
|||||||
argumentList = newArgumentList
|
argumentList = newArgumentList
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {
|
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {}
|
||||||
coneTypeOrNull = newConeTypeOrNull
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -29,7 +29,7 @@ internal class FirThrowExpressionImpl(
|
|||||||
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
||||||
override var exception: FirExpression,
|
override var exception: FirExpression,
|
||||||
) : FirThrowExpression() {
|
) : FirThrowExpression() {
|
||||||
override var coneTypeOrNull: ConeKotlinType? = StandardClassIds.Nothing.constructClassLikeType()
|
override val coneTypeOrNull: ConeKotlinType? = StandardClassIds.Nothing.constructClassLikeType()
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
@@ -52,9 +52,7 @@ internal class FirThrowExpressionImpl(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {
|
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {}
|
||||||
coneTypeOrNull = newConeTypeOrNull
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
||||||
annotations = newAnnotations.toMutableOrEmpty()
|
annotations = newAnnotations.toMutableOrEmpty()
|
||||||
|
|||||||
+2
-4
@@ -28,7 +28,7 @@ class FirUnitExpression @FirImplementationDetail constructor(
|
|||||||
override val source: KtSourceElement?,
|
override val source: KtSourceElement?,
|
||||||
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
override var annotations: MutableOrEmptyList<FirAnnotation>,
|
||||||
) : FirExpression() {
|
) : FirExpression() {
|
||||||
override var coneTypeOrNull: ConeKotlinType? = StandardClassIds.Unit.constructClassLikeType()
|
override val coneTypeOrNull: ConeKotlinType? = StandardClassIds.Unit.constructClassLikeType()
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
@@ -44,9 +44,7 @@ class FirUnitExpression @FirImplementationDetail constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {
|
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {}
|
||||||
coneTypeOrNull = newConeTypeOrNull
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
||||||
annotations = newAnnotations.toMutableOrEmpty()
|
annotations = newAnnotations.toMutableOrEmpty()
|
||||||
|
|||||||
+4
-1
@@ -122,7 +122,10 @@ abstract class AbstractFirTreeImplementationConfigurator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun defaultBuiltInType(type: String) {
|
fun defaultBuiltInType(type: String) {
|
||||||
default("coneTypeOrNull", "StandardClassIds.$type.constructClassLikeType()")
|
default("coneTypeOrNull") {
|
||||||
|
value = "StandardClassIds.$type.constructClassLikeType()"
|
||||||
|
isMutable = false
|
||||||
|
}
|
||||||
useTypes(standardClassIdsType, constructClassLikeTypeImport)
|
useTypes(standardClassIdsType, constructClassLikeTypeImport)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user