[K/N] Fix default argument lambda in suspend function code generation

This commit is contained in:
Pavel Kunyavskiy
2023-03-15 19:02:36 +01:00
committed by Space Team
parent 484d3ad273
commit e655e0a809
15 changed files with 156 additions and 0 deletions
@@ -316,6 +316,12 @@ private class DeclarationsGeneratorVisitor(override val generationState: NativeG
return KotlinObjCClassLlvmDeclarations(classInfoGlobal, bodyOffsetGlobal)
}
override fun visitValueParameter(declaration: IrValueParameter) {
// In some cases because of inconsistencies of previous lowerings, default values can be not removed.
// If they contain class or function, they would not be processed by code generator
// So we are skipping them here too.
}
private tailrec fun gcd(a: Long, b: Long) : Long = if (b == 0L) a else gcd(b, a % b)
override fun visitField(declaration: IrField) {
@@ -392,6 +398,9 @@ private class DeclarationsGeneratorVisitor(override val generationState: NativeG
else -> LLVMLinkage.LLVMInternalLinkage
}
val proto = LlvmFunctionProto(declaration, symbolName, this, linkage)
context.log {
"Creating llvm function ${symbolName} for ${declaration.render()}"
}
proto.createLlvmFunction(context, llvm.module)
}