dev.mokkery.plugin.ir.IrFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mokkery-plugin Show documentation
Show all versions of mokkery-plugin Show documentation
Mokkery is a mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.
The newest version!
package dev.mokkery.plugin.ir
import org.jetbrains.kotlin.ir.builders.declarations.buildClass
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrFactory
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
fun IrFactory.buildClass(name: Name, vararg superTypes: IrType?): IrClass {
val newClass = buildClass { this.name = name }
newClass.superTypes = superTypes.toList().filterNotNull()
newClass.thisReceiver = newClass.buildThisValueParam()
return newClass
}