[JS IR] Optimize JS AST blocks memory consumption

This commit is contained in:
Alexander Korepanov
2022-08-25 17:12:15 +02:00
committed by Space
parent ea34e10b67
commit c747d0e742
4 changed files with 9 additions and 6 deletions
@@ -423,7 +423,7 @@ private val IrModuleFragment.jsModuleName: String
get() = name.asString().dropWhile { it == '<' }.dropLastWhile { it == '>' }
private fun List<JsStatement>.toJsCodeString(): String =
JsCompositeBlock().also { it.statements += this }.toString()
JsCompositeBlock(this).toString()
enum class JsGenerationGranularity {
WHOLE_PROGRAM,
@@ -31,7 +31,7 @@ class JsCallTransformer(private val jsOrJsFuncCall: IrCall, private val context:
0 -> JsEmpty
1 -> newStatements.single().withSource(jsOrJsFuncCall, context)
// TODO: use transparent block (e.g. JsCompositeBlock)
else -> JsCompositeBlock().apply { statements += newStatements }
else -> JsCompositeBlock(newStatements)
}
}