Fir2Ir: pass Fir2IrExtensions to backend
This commit is contained in:
committed by
Alexander Udalov
parent
3c3c1be543
commit
13d4d60afa
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.util
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.*
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.addConstructor
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.buildClass
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.buildReceiverParameter
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.buildTypeParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
@@ -986,6 +987,18 @@ fun IrClass.createImplicitParameterDeclarationWithWrappedDescriptor() {
|
||||
thisReceiver = buildReceiverParameter(this, IrDeclarationOrigin.INSTANCE_RECEIVER, symbol.typeWithParameters(typeParameters))
|
||||
}
|
||||
|
||||
fun IrFactory.createSpecialAnnotationClass(fqn: FqName, parent: IrPackageFragment) =
|
||||
buildClass {
|
||||
kind = ClassKind.ANNOTATION_CLASS
|
||||
name = fqn.shortName()
|
||||
}.apply {
|
||||
createImplicitParameterDeclarationWithWrappedDescriptor()
|
||||
this.parent = parent
|
||||
addConstructor {
|
||||
isPrimary = true
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun isElseBranch(branch: IrBranch) = branch is IrElseBranch || ((branch.condition as? IrConst<Boolean>)?.value == true)
|
||||
|
||||
@@ -1242,4 +1255,4 @@ private fun computeAllOverridden(function: IrSimpleFunction, result: MutableSet<
|
||||
}
|
||||
|
||||
fun IrBuiltIns.getKFunctionType(returnType: IrType, parameterTypes: List<IrType>) =
|
||||
kFunctionN(parameterTypes.size).typeWith(parameterTypes + returnType)
|
||||
kFunctionN(parameterTypes.size).typeWith(parameterTypes + returnType)
|
||||
|
||||
Reference in New Issue
Block a user