Clean up backend.common.ir.IrUtils.kt

This commit is contained in:
Georgy Bronnikov
2018-09-19 15:40:13 +03:00
parent 376eef05f5
commit 4942ed5e7a
11 changed files with 75 additions and 63 deletions
@@ -36,18 +36,20 @@ abstract class IrLazyFunctionBase(
override var dispatchReceiverParameter: IrValueParameter? by lazyVar {
typeTranslator.buildWithScope(this) {
descriptor.dispatchReceiverParameter?.generateReceiverParameterStub()
descriptor.dispatchReceiverParameter?.generateReceiverParameterStub()?.also { it.parent = this@IrLazyFunctionBase }
}
}
override var extensionReceiverParameter: IrValueParameter? by lazyVar {
typeTranslator.buildWithScope(this) {
descriptor.extensionReceiverParameter?.generateReceiverParameterStub()
descriptor.extensionReceiverParameter?.generateReceiverParameterStub()?.also { it.parent = this@IrLazyFunctionBase }
}
}
override val valueParameters: MutableList<IrValueParameter> by lazy {
typeTranslator.buildWithScope(this) {
descriptor.valueParameters.mapTo(arrayListOf()) { stubGenerator.generateValueParameterStub(it) }
descriptor.valueParameters.mapTo(arrayListOf()) {
stubGenerator.generateValueParameterStub(it).apply { parent = this@IrLazyFunctionBase }
}
}
}
@@ -110,7 +110,13 @@ fun ClassifierDescriptor.toIrType(hasQuestionMark: Boolean = false, symbolTable:
return IrSimpleTypeImpl(defaultType, symbol, hasQuestionMark, listOf(), listOf())
}
val IrTypeParameter.defaultType: IrType get() = symbol.owner.defaultType
val IrTypeParameter.defaultType: IrType
get() = IrSimpleTypeImpl(
symbol,
hasQuestionMark = false,
arguments = emptyList(),
annotations = emptyList()
)
fun IrClassifierSymbol.typeWith(vararg arguments: IrType): IrSimpleType = typeWith(arguments.toList())