[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
@@ -8,7 +8,6 @@ import org.jetbrains.kotlin.js.util.AstUtil;
import org.jetbrains.annotations.NotNull;
import com.intellij.util.SmartList;
import java.util.ArrayList;
import java.util.List;
/**
@@ -19,7 +18,7 @@ public class JsBlock extends SourceInfoAwareJsNode implements JsStatement {
private final List<JsStatement> statements;
public JsBlock() {
this(new ArrayList<JsStatement>());
this(new SmartList<JsStatement>());
}
public JsBlock(JsStatement statement) {
@@ -9,7 +9,11 @@ import org.jetbrains.kotlin.js.util.AstUtil;
/**
* Represents a JavaScript block which could not be rendered into a material one.
*/
class JsCompositeBlock(statements: List<JsStatement> = mutableListOf()) : JsBlock(statements) {
class JsCompositeBlock : JsBlock {
constructor() : super()
constructor(statement: JsStatement) : super(statement)
constructor(statements: List<JsStatement>) : super(statements)
override fun isTransparent(): Boolean {
return true
}
@@ -20,4 +24,4 @@ class JsCompositeBlock(statements: List<JsStatement> = mutableListOf()) : JsBloc
globalBlockCopy.statements.addAll(statementscopy);
return globalBlockCopy.withMetadataFrom(this);
}
}
}