[FIR] Fix obsolete transforms & visit consistency
This commit is contained in:
@@ -53,7 +53,6 @@ internal class FirClassImpl(
|
||||
annotations.forEach { it.accept(visitor, data) }
|
||||
typeParameters.forEach { it.accept(visitor, data) }
|
||||
status.accept(visitor, data)
|
||||
(declarations.firstOrNull { it is FirConstructorImpl } as? FirConstructorImpl)?.typeParameters?.forEach { it.accept(visitor, data) }
|
||||
declarations.forEach { it.accept(visitor, data) }
|
||||
superTypeRefs.forEach { it.accept(visitor, data) }
|
||||
controlFlowGraphReference.accept(visitor, data)
|
||||
@@ -63,7 +62,6 @@ internal class FirClassImpl(
|
||||
transformAnnotations(transformer, data)
|
||||
typeParameters.transformInplace(transformer, data)
|
||||
transformStatus(transformer, data)
|
||||
(declarations.firstOrNull { it is FirConstructorImpl } as? FirConstructorImpl)?.typeParameters?.transformInplace(transformer, data)
|
||||
declarations.transformInplace(transformer, data)
|
||||
companionObject = declarations.asSequence().filterIsInstance<FirRegularClass>().firstOrNull { it.status.isCompanion }
|
||||
superTypeRefs.transformInplace(transformer, data)
|
||||
|
||||
@@ -52,6 +52,7 @@ internal class FirConstructorImpl(
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
returnTypeRef.accept(visitor, data)
|
||||
receiverTypeRef?.accept(visitor, data)
|
||||
typeParameters.forEach { it.accept(visitor, data) }
|
||||
controlFlowGraphReference.accept(visitor, data)
|
||||
valueParameters.forEach { it.accept(visitor, data) }
|
||||
status.accept(visitor, data)
|
||||
@@ -63,6 +64,7 @@ internal class FirConstructorImpl(
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirConstructorImpl {
|
||||
transformReturnTypeRef(transformer, data)
|
||||
transformReceiverTypeRef(transformer, data)
|
||||
typeParameters.transformInplace(transformer, data)
|
||||
transformControlFlowGraphReference(transformer, data)
|
||||
transformValueParameters(transformer, data)
|
||||
transformStatus(transformer, data)
|
||||
|
||||
+2
@@ -52,6 +52,7 @@ internal class FirPrimaryConstructor(
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
returnTypeRef.accept(visitor, data)
|
||||
receiverTypeRef?.accept(visitor, data)
|
||||
typeParameters.forEach { it.accept(visitor, data) }
|
||||
controlFlowGraphReference.accept(visitor, data)
|
||||
valueParameters.forEach { it.accept(visitor, data) }
|
||||
status.accept(visitor, data)
|
||||
@@ -63,6 +64,7 @@ internal class FirPrimaryConstructor(
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirPrimaryConstructor {
|
||||
transformReturnTypeRef(transformer, data)
|
||||
transformReceiverTypeRef(transformer, data)
|
||||
typeParameters.transformInplace(transformer, data)
|
||||
transformControlFlowGraphReference(transformer, data)
|
||||
transformValueParameters(transformer, data)
|
||||
transformStatus(transformer, data)
|
||||
|
||||
@@ -56,7 +56,6 @@ internal class FirSealedClassImpl(
|
||||
annotations.forEach { it.accept(visitor, data) }
|
||||
typeParameters.forEach { it.accept(visitor, data) }
|
||||
status.accept(visitor, data)
|
||||
(declarations.firstOrNull { it is FirConstructorImpl } as? FirConstructorImpl)?.typeParameters?.forEach { it.accept(visitor, data) }
|
||||
declarations.forEach { it.accept(visitor, data) }
|
||||
superTypeRefs.forEach { it.accept(visitor, data) }
|
||||
controlFlowGraphReference.accept(visitor, data)
|
||||
@@ -66,7 +65,6 @@ internal class FirSealedClassImpl(
|
||||
transformAnnotations(transformer, data)
|
||||
typeParameters.transformInplace(transformer, data)
|
||||
transformStatus(transformer, data)
|
||||
(declarations.firstOrNull { it is FirConstructorImpl } as? FirConstructorImpl)?.typeParameters?.transformInplace(transformer, data)
|
||||
declarations.transformInplace(transformer, data)
|
||||
companionObject = declarations.asSequence().filterIsInstance<FirRegularClass>().firstOrNull { it.status.isCompanion }
|
||||
superTypeRefs.transformInplace(transformer, data)
|
||||
|
||||
-6
@@ -19,16 +19,10 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
private fun configure() = with(FirTreeBuilder) {
|
||||
impl(constructor) {
|
||||
defaultFalse("isPrimary", withGetter = true)
|
||||
default("typeParameters") {
|
||||
needAcceptAndTransform = false
|
||||
}
|
||||
}
|
||||
|
||||
impl(constructor, "FirPrimaryConstructor") {
|
||||
defaultTrue("isPrimary", withGetter = true)
|
||||
default("typeParameters") {
|
||||
needAcceptAndTransform = false
|
||||
}
|
||||
}
|
||||
|
||||
impl(typeParameterRef, "FirOuterClassTypeParameterRef")
|
||||
|
||||
-8
@@ -147,9 +147,6 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (type in setOf("FirClassImpl", "FirSealedClassImpl") && field.name == "declarations") {
|
||||
println("(declarations.firstOrNull { it is FirConstructorImpl } as? FirConstructorImpl)?.typeParameters?.forEach { it.accept(visitor, data) }")
|
||||
}
|
||||
if (type == "FirWhenExpressionImpl" && field.name == "subject") {
|
||||
println(
|
||||
"""
|
||||
@@ -221,11 +218,6 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
|
||||
field.name in setOf("dispatchReceiver", "extensionReceiver") -> {}
|
||||
|
||||
type in setOf("FirClassImpl", "FirSealedClassImpl") && field.name == "declarations" -> {
|
||||
println("(declarations.firstOrNull { it is FirConstructorImpl } as? FirConstructorImpl)?.typeParameters?.transformInplace(transformer, data)")
|
||||
println("declarations.transformInplace(transformer, data)")
|
||||
}
|
||||
|
||||
field.name == "companionObject" -> {
|
||||
println("companionObject = declarations.asSequence().filterIsInstance<FirRegularClass>().firstOrNull { it.status.isCompanion }")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user