[FIR-PLUGIN] Fix allopen plugin due to previous commits
This commit is contained in:
+10
@@ -9,12 +9,22 @@ import org.jetbrains.kotlin.descriptors.Modality
|
|||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
|
import org.jetbrains.kotlin.fir.extensions.AnnotationFqn
|
||||||
import org.jetbrains.kotlin.fir.extensions.FirStatusTransformerExtension
|
import org.jetbrains.kotlin.fir.extensions.FirStatusTransformerExtension
|
||||||
import org.jetbrains.kotlin.fir.extensions.transform
|
import org.jetbrains.kotlin.fir.extensions.transform
|
||||||
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
|
||||||
class AllOpenStatusTransformer(session: FirSession) : FirStatusTransformerExtension(session) {
|
class AllOpenStatusTransformer(session: FirSession) : FirStatusTransformerExtension(session) {
|
||||||
override fun transformStatus(declaration: FirDeclaration, status: FirDeclarationStatus): FirDeclarationStatus {
|
override fun transformStatus(declaration: FirDeclaration, status: FirDeclarationStatus): FirDeclarationStatus {
|
||||||
if (status.modality != null) return status
|
if (status.modality != null) return status
|
||||||
return status.transform(modality = Modality.OPEN)
|
return status.transform(modality = Modality.OPEN)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val mode: Mode
|
||||||
|
get() = Mode.ALL_IN_ANNOTATED_ELEMENT
|
||||||
|
|
||||||
|
override val annotations: Set<AnnotationFqn> = setOf(FqName.fromSegments(listOf("allopen", "Open")))
|
||||||
|
|
||||||
|
override val metaAnnotations: Set<AnnotationFqn>
|
||||||
|
get() = emptySet()
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,21 @@
|
|||||||
|
// FILE: annotations.kt
|
||||||
|
|
||||||
|
package allopen
|
||||||
|
|
||||||
|
annotation class Open
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
import allopen.Open
|
||||||
|
|
||||||
|
@Open
|
||||||
class A {
|
class A {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Open
|
||||||
class B : A() {
|
class B : A() {
|
||||||
override fun foo() {
|
override fun foo() {
|
||||||
|
|
||||||
|
|||||||
+10
-3
@@ -1,5 +1,12 @@
|
|||||||
FILE: simple.kt
|
FILE: annotations.kt
|
||||||
public open class A : R|kotlin/Any| {
|
public final annotation class Open : R|kotlin/Annotation| {
|
||||||
|
public constructor(): R|allopen/Open| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
FILE: main.kt
|
||||||
|
@R|allopen/Open|() public open class A : R|kotlin/Any| {
|
||||||
public constructor(): R|A| {
|
public constructor(): R|A| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
@@ -8,7 +15,7 @@ FILE: simple.kt
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public open class B : R|A| {
|
@R|allopen/Open|() public open class B : R|A| {
|
||||||
public constructor(): R|B| {
|
public constructor(): R|B| {
|
||||||
super<R|A|>()
|
super<R|A|>()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user