[JS IR BE] Support tailreq in JS
This commit is contained in:
+2
-2
@@ -53,7 +53,7 @@ private fun lowerTailRecursionCalls(context: BackendContext, irFunction: IrFunct
|
||||
irFunction.body = builder.irBlockBody {
|
||||
// Define variables containing current values of parameters:
|
||||
val parameterToVariable = parameters.associate {
|
||||
it to irTemporaryVar(irGet(it), nameHint = it.symbol.suggestVariableName())
|
||||
it to irTemporaryVar(irGet(it), nameHint = it.symbol.suggestVariableName(), parent = irFunction)
|
||||
}
|
||||
// (these variables are to be updated on any tail call).
|
||||
|
||||
@@ -65,7 +65,7 @@ private fun lowerTailRecursionCalls(context: BackendContext, irFunction: IrFunct
|
||||
// Read variables containing current values of parameters:
|
||||
val parameterToNew = parameters.associate {
|
||||
val variable = parameterToVariable[it]!!
|
||||
it to irTemporary(irGet(variable), nameHint = it.symbol.suggestVariableName())
|
||||
it to irTemporary(irGet(variable), nameHint = it.symbol.suggestVariableName()).also { it.parent = irFunction }
|
||||
}
|
||||
|
||||
val transformer = BodyTransformer(
|
||||
|
||||
@@ -105,6 +105,7 @@ private fun JsIrBackendContext.performInlining(moduleFragment: IrModuleFragment)
|
||||
|
||||
private fun JsIrBackendContext.lower(moduleFragment: IrModuleFragment, dependencies: List<IrModuleFragment>) {
|
||||
moduleFragment.files.forEach(ThrowableSuccessorsLowering(this)::lower)
|
||||
moduleFragment.files.forEach(TailrecLowering(this)::runOnFilePostfix)
|
||||
moduleFragment.files.forEach(UnitMaterializationLowering(this)::lower)
|
||||
moduleFragment.files.forEach(EnumClassLowering(this)::runOnFilePostfix)
|
||||
moduleFragment.files.forEach(EnumUsageLowering(this)::lower)
|
||||
|
||||
Reference in New Issue
Block a user