Added possibility of debug output from lowerings
This commit is contained in:
+8
@@ -318,6 +318,14 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable): Sym
|
||||
val freeze = symbolTable.referenceSimpleFunction(
|
||||
builtInsPackage("konan", "worker").getContributedFunctions(Name.identifier("freeze"), NoLookupLocation.FROM_BACKEND).single())
|
||||
|
||||
val println = symbolTable.referenceSimpleFunction(
|
||||
builtInsPackage("kotlin", "io").getContributedFunctions(Name.identifier("println"), NoLookupLocation.FROM_BACKEND)
|
||||
.single { it.valueParameters.singleOrNull()?.type == builtIns.stringType })
|
||||
|
||||
val anyNToString = symbolTable.referenceSimpleFunction(
|
||||
builtInsPackage("kotlin").getContributedFunctions(Name.identifier("toString"), NoLookupLocation.FROM_BACKEND)
|
||||
.single { it.extensionReceiverParameter?.type == builtIns.nullableAnyType})
|
||||
|
||||
val getContinuation = symbolTable.referenceSimpleFunction(
|
||||
context.getInternalFunctions("getContinuation").single())
|
||||
|
||||
|
||||
+7
@@ -1194,6 +1194,13 @@ internal class SuspendFunctionsLowering(val context: Context): FileLoweringPass
|
||||
private fun IrBuilderWithScope.irThrowIfNotNull(exception: IrValueDeclaration) =
|
||||
irIfThen(irNot(irEqeqeq(irGet(exception), irNull())),
|
||||
irThrow(irImplicitCast(irGet(exception), exception.type.makeNotNull())))
|
||||
|
||||
fun IrBuilderWithScope.irDebugOutput(value: IrExpression) =
|
||||
irCall(symbols.println).apply {
|
||||
putValueArgument(0, irCall(symbols.anyNToString).apply {
|
||||
extensionReceiver = value
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private open class VariablesScopeTracker: IrElementVisitorVoid {
|
||||
|
||||
Reference in New Issue
Block a user