All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.seskar.compiler.mixin.backend.MixinTransformer.kt Maven / Gradle / Ivy

There is a newer version: 3.32.0
Show newest version
package seskar.compiler.mixin.backend

import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid

internal class MixinTransformer : IrElementTransformerVoid() {
    override fun visitClass(declaration: IrClass): IrStatement {
        if (declaration.isExternal && declaration.kind == ClassKind.CLASS) {
            val mixins = declaration.superTypes.filter { it.isMixin() }
            if (mixins.isNotEmpty()) {
                declaration.superTypes -= mixins
            }
        }

        return declaration
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy