From ee29a6f5d29e26d66617750520a0d7dd3b8afe9b Mon Sep 17 00:00:00 2001 From: Albert24GG Date: Fri, 8 Aug 2025 17:08:06 +0300 Subject: [PATCH] Use templated lowering for `_d_newarray*` --- gen/toir.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/gen/toir.cpp b/gen/toir.cpp index fc8d65a854..12372e2976 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -1578,15 +1578,9 @@ class ToElemVisitor : public Visitor { // get dim assert(e->arguments); assert(e->arguments->length >= 1); - if (e->arguments->length == 1) { - DValue *sz = toElem((*e->arguments)[0]); - // allocate & init - result = DtoNewDynArray(e->loc, e->newtype, sz, true); - } else { - assert(e->lowering); - LLValue *pair = DtoRVal(e->lowering); - result = new DSliceValue(e->type, pair); - } + assert(e->lowering); + LLValue *pair = DtoRVal(e->lowering); + result = new DSliceValue(e->type, pair); } // new static array else if (ntype->ty == TY::Tsarray) {