Merge pull request #1349 from larsclausen/new-array-init-cleanup
elab: Use common new array initializer elaboration
This commit is contained in:
commit
fb6dfebcec
13
elab_expr.cc
13
elab_expr.cc
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue