[K/Wasm] Rework Wasm enumEntriesIntrinsic declaration to fix stdlib compilation

This commit is contained in:
Artem Kobzar
2023-08-01 11:53:14 +00:00
committed by Space Team
parent 12715c062d
commit cd840997b1
5 changed files with 36 additions and 10 deletions
@@ -33,10 +33,13 @@ internal class JsInlineFunctionResolver(context: JsIrBackendContext) : DefaultIn
private val inlineFunctionsBeforeInlining = context.mapping.inlineFunctionsBeforeInlining
private val inlineFunctionsBeforeInliningSymbols = hashMapOf<IrFunction, IrFunctionSymbol>()
override fun shouldExcludeFunctionFromInlining(symbol: IrFunctionSymbol): Boolean {
// TODO: After the expect fun enumEntriesIntrinsic become non-inline function, the code will be removed
return symbol == enumEntriesIntrinsic || super.shouldExcludeFunctionFromInlining(symbol)
}
override fun getFunctionDeclaration(symbol: IrFunctionSymbol): IrFunction {
val function = super.getFunctionDeclaration(symbol)
// TODO: After the expect fun enumEntriesIntrinsic become non-inline function, the code will be removed
if (function.symbol == enumEntriesIntrinsic) return function.apply { body = null }
val functionBeforeInlining = inlineFunctionsBeforeInlining[function] ?: return function
inlineFunctionsBeforeInliningSymbols[functionBeforeInlining] = function.symbol
return functionBeforeInlining