[IR] Move IrFactory#createExpressionBody overloads to extension methods

This is to prepare for IrFactory auto-generation (KT-59308).
This commit is contained in:
Sergej Jaskiewicz
2023-06-14 14:50:53 +02:00
committed by Space Team
parent ea8b482f4f
commit 3f6420c5b9
14 changed files with 61 additions and 66 deletions
@@ -106,9 +106,11 @@ class InitializersCleanupLowering(
} else {
declaration.initializer?.let {
declaration.initializer =
context.irFactory.createExpressionBody(it.startOffset, it.endOffset) {
expression = it.expression.deepCopyWithSymbols()
}
context.irFactory.createExpressionBody(
startOffset = it.startOffset,
endOffset = it.endOffset,
expression = it.expression.deepCopyWithSymbols(),
)
}
}
}
@@ -44,9 +44,11 @@ class InnerClassesLowering(val context: BackendContext, private val innerClasses
val variableRemapper = VariableRemapper(oldConstructorParameterToNew)
for ((oldParam, newParam) in oldConstructorParameterToNew.entries) {
newParam.defaultValue = oldParam.defaultValue?.let { oldDefault ->
context.irFactory.createExpressionBody(oldDefault.startOffset, oldDefault.endOffset) {
expression = oldDefault.expression.transform(variableRemapper, null).patchDeclarationParents(newConstructor)
}
context.irFactory.createExpressionBody(
startOffset = oldDefault.startOffset,
endOffset = oldDefault.endOffset,
expression = oldDefault.expression.transform(variableRemapper, null).patchDeclarationParents(newConstructor),
)
}
}