Merge pull request #1349 from larsclausen/new-array-init-cleanup

elab: Use common new array initializer elaboration
This commit is contained in:
Cary R. 2026-05-10 15:24:56 -07:00 committed by GitHub
commit fb6dfebcec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 12 deletions

View File

@ -6640,19 +6640,8 @@ NetExpr* PENewArray::elaborate_expr(Design*des, NetScope*scope,
NetExpr*size = size_->elaborate_expr(des, scope, use_wid, flags);
NetExpr*init_val = 0;
if (dynamic_cast<PEAssignPattern*> (init_)) {
// Special case: the initial value expression is an
// array_pattern. Elaborate the expression like the
// r-value to an assignment to array.
if (init_) {
init_val = init_->elaborate_expr(des, scope, ntype, flags);
} else if (init_) {
// Regular case: The initial value is an
// expression. Elaborate the expression as an element
// type. The run-time will assign this value to each element.
const netarray_t*array_type = dynamic_cast<const netarray_t*> (ntype);
init_val = init_->elaborate_expr(des, scope, array_type, flags);
}
NetENew*tmp = new NetENew(ntype, size, init_val);