[K/Wasm] Fix object optimization false trigger on non-pure objects ^KT-66471 Fixed

This commit is contained in:
Artem Kobzar
2024-03-14 17:12:45 +00:00
committed by Space Team
parent a2a0e8cb38
commit eb8054ac1e
23 changed files with 147 additions and 1 deletions
@@ -87,7 +87,7 @@ class PurifyObjectInstanceGettersLowering(val context: JsCommonBackendContext) :
private fun IrStatement.isPureStatementForObjectInitialization(owner: IrClass): Boolean {
return (
this is IrReturn ||
(this is IrReturn && value.isPureStatementForObjectInitialization(owner)) ||
// Only objects which don't have a class parent
(this is IrDelegatingConstructorCall && symbol.owner.parent == context.irBuiltIns.anyClass.owner) ||
(this is IrExpression && isPure(anyVariable = true, checkFields = false, context = context)) ||