[JS PIR] Fix inliner. Do not mutate existed statement list
Such list could be part of PIR structures
This commit is contained in:
committed by
teamcityserver
parent
20088994c1
commit
334e34b70b
+5
-3
@@ -195,8 +195,10 @@ class FunctionInlining(
|
|||||||
val irBuilder = context.createIrBuilder(irReturnableBlockSymbol, endOffset, endOffset)
|
val irBuilder = context.createIrBuilder(irReturnableBlockSymbol, endOffset, endOffset)
|
||||||
|
|
||||||
val transformer = ParameterSubstitutor()
|
val transformer = ParameterSubstitutor()
|
||||||
statements.transform { it.transform(transformer, data = null) }
|
val newStatements = mutableListOf<IrStatement>()
|
||||||
statements.addAll(0, evaluationStatements)
|
|
||||||
|
newStatements.addAll(evaluationStatements)
|
||||||
|
statements.mapTo(newStatements) { it.transform(transformer, data = null) as IrStatement }
|
||||||
|
|
||||||
return IrReturnableBlockImpl(
|
return IrReturnableBlockImpl(
|
||||||
startOffset = callSite.startOffset,
|
startOffset = callSite.startOffset,
|
||||||
@@ -204,7 +206,7 @@ class FunctionInlining(
|
|||||||
type = callSite.type,
|
type = callSite.type,
|
||||||
symbol = irReturnableBlockSymbol,
|
symbol = irReturnableBlockSymbol,
|
||||||
origin = null,
|
origin = null,
|
||||||
statements = statements,
|
statements = newStatements,
|
||||||
inlineFunctionSymbol = callee.symbol
|
inlineFunctionSymbol = callee.symbol
|
||||||
).apply {
|
).apply {
|
||||||
transformChildrenVoid(object : IrElementTransformerVoid() {
|
transformChildrenVoid(object : IrElementTransformerVoid() {
|
||||||
|
|||||||
Reference in New Issue
Block a user