JVM_IR. Mostly remove descriptors from InterfaceLowering

Descriptors are only used to generate a new method name via a call to
KotlinTypeMapper.
This commit is contained in:
Georgy Bronnikov
2018-10-25 13:07:08 +03:00
parent 55b65546fa
commit cbc46fe6e4
8 changed files with 99 additions and 121 deletions
@@ -153,10 +153,10 @@ fun IrClass.addSimpleDelegatingConstructor(
val IrCall.isSuspend get() = (symbol.owner as? IrSimpleFunction)?.isSuspend == true
val IrFunctionReference.isSuspend get() = (symbol.owner as? IrSimpleFunction)?.isSuspend == true
fun IrValueParameter.copyTo(
irFunction: IrFunction,
shift: Int = 0,
index: Int? = null,
startOffset: Int = this.startOffset,
endOffset: Int = this.endOffset,
origin: IrDeclarationOrigin = this.origin,
@@ -164,13 +164,16 @@ fun IrValueParameter.copyTo(
type: IrType = this.type.remapTypeParameters(this.parent as IrTypeParametersContainer, irFunction),
varargElementType: IrType? = this.varargElementType
): IrValueParameter {
// You cannot specify both index and nontrivial shift.
assert(index == null || shift == 0)
val newIndex = index ?: (shift + this.index)
val descriptor = WrappedValueParameterDescriptor(symbol.descriptor.annotations, symbol.descriptor.source)
val symbol = IrValueParameterSymbolImpl(descriptor)
val defaultValueCopy = defaultValue?.deepCopyWithVariables()
defaultValueCopy?.patchDeclarationParents(irFunction)
return IrValueParameterImpl(
startOffset, endOffset, origin, symbol,
name, shift + index, type, varargElementType, isCrossinline, isNoinline
name, newIndex, type, varargElementType, isCrossinline, isNoinline
).also {
descriptor.bind(it)
it.parent = irFunction