main.seskar.compiler.react.memo.extensions.MemoTransformExtension.kt Maven / Gradle / Ivy
package seskar.compiler.react.memo.extensions
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
import org.jetbrains.kotlin.platform.isJs
import seskar.compiler.react.memo.backend.MemoTransformer
internal class MemoTransformExtension : IrGenerationExtension {
override fun generate(
moduleFragment: IrModuleFragment,
pluginContext: IrPluginContext,
) {
pluginContext.platform
?.takeIf { it.isJs() }
?: return
moduleFragment.transformChildrenVoid(MemoTransformer(pluginContext))
}
}