CollectionsBuilders

class CollectionsBuilders(stdlib: StdlibBuilders, builder: IrBuilderWithScope, context: IrPluginContext) : MethodBuilder

Functions

Link copied to clipboard
open fun Boolean.asConst(type: IrType = context.irBuiltIns.booleanType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Boolean>
open fun Byte.asConst(type: IrType = context.irBuiltIns.byteType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Byte>
open fun Char.asConst(type: IrType = context.irBuiltIns.charType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Char>
open fun Double.asConst(type: IrType = context.irBuiltIns.doubleType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Double>
open fun Float.asConst(type: IrType = context.irBuiltIns.floatType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Float>
open fun Int.asConst(type: IrType = context.irBuiltIns.intType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Int>
open fun Long.asConst(type: IrType = context.irBuiltIns.longType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Long>
open fun Short.asConst(type: IrType = context.irBuiltIns.shortType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Short>
open fun String.asConst(type: IrType = context.irBuiltIns.stringType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<String>
Link copied to clipboard
open fun IrBuilderWithScope.buildLambda(returnType: IrType?, funBuilder: IrFunctionBuilder.() -> Unit = {}, funApply: IrSimpleFunction.() -> Unit): IrSimpleFunction

Builds a local function to be used as a lambda, likely with lambdaArgument Return type must be specified at some point, but may be passed as null and specified later. Will be automatically set if the lambda has an expression body and it wasn't set in funBuilder or funApply

Link copied to clipboard
inline fun <T : IrElement> buildStatement(startOffset: Int, endOffset: Int, block: IrSingleStatementBuilder.() -> T): T

Build a statement using the underlying builder. Should only be used for extensions.

open fun <T : IrElement> IrSymbolOwner.buildStatement(startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET, origin: IrStatementOrigin? = null, block: IrSingleStatementBuilder.() -> T): T
Link copied to clipboard
open fun createIrBuilder(symbol: IrSymbol, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): DeclarationIrBuilder
Link copied to clipboard
open fun IrSymbolOwner.createIrBuilderAt(): DeclarationIrBuilder
Link copied to clipboard
fun emptyList(elementType: IrType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun emptyMap(keyType: IrType, valueType: IrType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun emptyMutableList(elementType: IrType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun emptyMutableMap(keyType: IrType, valueType: IrType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun emptyMutableSet(elementType: IrType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun emptySet(elementType: IrType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
open operator fun <R : IrBindableSymbol<*, *>> Reference<R>.invoke(): R
open operator fun TypeRef.invoke(): IrType
Link copied to clipboard
open fun IrBuilderWithScope.irCall(funcRef: FunctionRef): IrCall
open fun IrBuilderWithScope.irCall(funcRef: FunctionRef, type: IrType): IrCall
Link copied to clipboard
open fun IrClass.isSubclassOf(klass: ClassRef): Boolean
open fun IrType.isSubclassOf(klass: ClassRef): Boolean
Link copied to clipboard
open fun lambdaArgument(lambda: IrSimpleFunction, type: IrType = run { //TODO workaround for https://youtrack.jetbrains.com/issue/KT-46896 val base = if (lambda.isSuspend) context.referenceClass( StandardNames.getSuspendFunctionClassId(lambda.allParameters.size).asSingleFqName() ) ?: error("suspend function type not found") else context.referenceClass(StandardNames.getFunctionClassId(lambda.allParameters.size).asSingleFqName()) ?: error("function type not found") base.typeWith(lambda.allParameters.map { it.type } + lambda.returnType) }, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrFunctionExpression

Creates a IrFunctionExpressionImpl from the given function, auto-inferring the type if not specified

Link copied to clipboard
fun listOf(elementType: IrType, items: Iterable<IrExpression>, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun listOfNotNull(elementType: IrType, items: Iterable<IrExpression>, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun listOfVararg(items: IrVararg, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
fun listOfVararg(elementType: IrType, items: IrVararg, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun mapOf(keyType: IrType, valueType: IrType, items: Map<IrExpression, IrExpression>, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun mutableListOf(elementType: IrType, items: Iterable<IrExpression>, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun mutableMapOf(keyType: IrType, valueType: IrType, items: Map<IrExpression, IrExpression>, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun mutableSetOf(elementType: IrType, items: Iterable<IrExpression>, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
open fun nullConst(type: IrType, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrConst<Nothing?>
Link copied to clipboard
open fun <R : IrBindableSymbol<*, *>> Reference<R>.resolve(): R
open fun TypeRef.resolve(): IrType
Link copied to clipboard
open fun <R : IrBindableSymbol<*, *>> Reference<R>.resolveOrNull(): R?
Link copied to clipboard
open fun ClassRef.resolveTypeWith(vararg arguments: IrType): IrSimpleType
Link copied to clipboard
fun setOf(elementType: IrType, items: Iterable<IrExpression>, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
fun setOfNotNull(elementType: IrType, items: Iterable<IrExpression>, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET): IrCall
Link copied to clipboard
open fun KotlinType.toIr(): IrType
Link copied to clipboard
open fun <T> IrSymbolOwner.withBuilder(block: DeclarationIrBuilder.() -> T): T

Properties

Link copied to clipboard
val Collection: CollectionBuilders
Link copied to clipboard
open override val context: IrPluginContext
Link copied to clipboard
open val factory: IrFactory
Link copied to clipboard
val Iterable: IterableBuilders
Link copied to clipboard
open val IrBuilderWithScope.kotlin: StdlibBuilders

Get the standard library builders

Link copied to clipboard
val List: ListBuilders
Link copied to clipboard
val Map: MapBuilders
Link copied to clipboard
val MutableList: MutableListBuilders
Link copied to clipboard
val MutableMap: MutableMapBuilders
Link copied to clipboard
val MutableSet: MutableSetBuilders
Link copied to clipboard
val Set: SetBuilders
Link copied to clipboard
open val IrBuilderWithScope.stdlib: StdlibBuilders

Get the standard library builders

Sources

Link copied to clipboard