refactor: use explicit sizes in asmGenerator

This commit is contained in:
2025-02-28 17:21:45 +00:00
parent e1d90eabf9
commit 68903f5b69
2 changed files with 35 additions and 32 deletions

View File

@@ -9,8 +9,6 @@ object sizeExtensions {
/** Calculate the size (bytes) of the heap required for the expression. */
def heapSize: Int = (expr, expr.ty) match {
case (ArrayLiter(elems), KnownType.Array(KnownType.Char)) =>
KnownType.Int.size.toInt + elems.size.toInt * KnownType.Char.size.toInt
case (ArrayLiter(elems), ty) =>
KnownType.Int.size.toInt + elems.size * ty.elemSize.toInt
case _ => expr.ty.size.toInt