* Enabled inlining of stdlib

* Fixed two bugs in inlining
This commit is contained in:
Igor Chevdar
2017-04-03 17:33:00 +03:00
parent fffbff1365
commit d9e400f39e
2 changed files with 3 additions and 5 deletions
@@ -271,7 +271,7 @@ internal class DeepCopyIrTreeWithDescriptors(val targetFunction: IrFunction, val
if (irCall !is IrCallImpl) return irCall // TODO what other kinds of call can we meet?
val oldDescriptor = irCall.descriptor
val newDescriptor = descriptorSubstituteMap.getOrDefault(oldDescriptor,
val newDescriptor = descriptorSubstituteMap.getOrDefault(oldDescriptor.original,
oldDescriptor) as FunctionDescriptor
val oldSuperQualifier = irCall.superQualifier
@@ -85,9 +85,6 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoid(
override fun visitCall(expression: IrCall): IrExpression {
val fqName = currentFile!!.packageFragmentDescriptor.fqName.asString() // TODO to be removed after stdlib compilation
if(fqName.contains("kotlin")) return super.visitCall(expression) // TODO to be removed after stdlib compilation
val irCall = super.visitCall(expression) as IrCall
val functionDescriptor = irCall.descriptor as FunctionDescriptor
@@ -271,7 +268,8 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoid(
val operandTypeDescriptor = newExpression.typeOperand.constructor.declarationDescriptor
if (operandTypeDescriptor !is TypeParameterDescriptor) return newExpression // It is not TypeParameter - do nothing
var typeNew = typeArgsMap[operandTypeDescriptor]!!
var typeNew = typeArgsMap[operandTypeDescriptor]
?: return expression
if (newExpression.typeOperand.isMarkedNullable)
typeNew = typeNew.makeNullable()
val startOffset = newExpression.startOffset