[JVM_IR] Avoid unbounded recursion for recursive suspend functions.

Additionally, deal with primitive types in AddContinuationLowering.
This commit is contained in:
Mads Ager
2019-10-14 17:54:13 +02:00
committed by Ilmir Usmanov
parent ed6ca7d67e
commit 8305baa5fe
8 changed files with 24 additions and 20 deletions
@@ -396,17 +396,8 @@ open class DefaultParameterInjector(
nullConst(startOffset, endOffset, irParameter.type)
}
protected open fun nullConst(startOffset: Int, endOffset: Int, type: IrType): IrExpression = when {
type.isFloat() -> IrConstImpl.float(startOffset, endOffset, type, 0.0F)
type.isDouble() -> IrConstImpl.double(startOffset, endOffset, type, 0.0)
type.isBoolean() -> IrConstImpl.boolean(startOffset, endOffset, type, false)
type.isByte() -> IrConstImpl.byte(startOffset, endOffset, type, 0)
type.isChar() -> IrConstImpl.char(startOffset, endOffset, type, 0.toChar())
type.isShort() -> IrConstImpl.short(startOffset, endOffset, type, 0)
type.isInt() -> IrConstImpl.int(startOffset, endOffset, type, 0)
type.isLong() -> IrConstImpl.long(startOffset, endOffset, type, 0)
else -> IrConstImpl.constNull(startOffset, endOffset, context.irBuiltIns.nothingNType)
}
protected open fun nullConst(startOffset: Int, endOffset: Int, type: IrType): IrExpression =
IrConstImpl.defaultValueForType(startOffset, endOffset, type)
private fun log(msg: () -> String) = context.log { "DEFAULT-INJECTOR: ${msg()}" }
}