WIP
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/SideEffects.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/SideEffects.kt
index 13b4b55..23e2f93 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/SideEffects.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/SideEffects.kt
@@ -44,8 +44,7 @@
* [otherwise] is the effects that a function would have if we removed all the [AlmostPureSingletonConstructor] effects from it.
*/
data class AlmostPureSingletonConstructor(val otherwise: SideEffects) :
- SideEffects(2 + otherwise.level, "ALMOST_PURE_SINGLETON_CONSTRUCTOR")
- {
+ SideEffects(2 + otherwise.level, "ALMOST_PURE_SINGLETON_CONSTRUCTOR") {
init {
require(otherwise !is AlmostPureSingletonConstructor)
}
@@ -58,6 +57,8 @@
fun isAtMost(other: SideEffects) = level <= other.level
+ override fun toString() = name
+
companion object {
fun valueOf(s: String) = when (s) {
ReadNone.name -> ReadNone
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/cleanup/CleanupLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/cleanup/CleanupLowering.kt
index a21de50..9834e27 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/cleanup/CleanupLowering.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/cleanup/CleanupLowering.kt
@@ -68,6 +68,10 @@
private fun cleanUpStatementsSinglePass(statements: List<IrStatement>): List<IrStatement> = buildList {
var unreachable = false
for (statement in statements) {
+ if (statement is IrDelegatingConstructorCall) {
+ add(statement)
+ continue
+ }
if (statement is IrFunctionAccessExpression) {
val functionSideEffect = statement.symbol.owner.computeEffects(true, functionSideEffectMemoizer, context)
@@ -84,7 +88,8 @@
statement is IrBreakContinue -> true
statement is IrExpression && (statement.computeEffects(
true,
- functionSideEffectMemoizer
+ functionSideEffectMemoizer,
+ context
).isAtMost(SideEffects.ReadOnly)) -> false
unreachable -> false
else -> {