diff --git a/elab_type.cc b/elab_type.cc index 49d3483df..4641b1507 100644 --- a/elab_type.cc +++ b/elab_type.cc @@ -34,44 +34,6 @@ using namespace std; -/* - * Some types have a list of ranges that need to be elaborated. This - * function elaborates the ranges referenced by "dims" into the vector - * "ranges". - */ -static void elaborate_array_ranges(Design*des, NetScope*scope, - vector&ranges, - const list*dims) -{ - if (dims == 0) - return; - - for (list::const_iterator cur = dims->begin() - ; cur != dims->end() ; ++ cur) { - - NetExpr*me = elab_and_eval(des, scope, cur->first, 0, true); - - NetExpr*le = elab_and_eval(des, scope, cur->second, 0, true); - - /* If elaboration failed for either expression, we - should have already reported the error, so just - skip the following evaluation to recover. */ - - long mnum = 0, lnum = 0; - if ( me && ! eval_as_long(mnum, me) ) { - assert(0); - des->errors += 1; - } - - if ( le && ! eval_as_long(lnum, le) ) { - assert(0); - des->errors += 1; - } - - ranges.push_back(netrange_t(mnum, lnum)); - } -} - /* * Elaborations of types may vary depending on the scope that it is * done in, so keep a per-scope cache of the results. @@ -164,7 +126,8 @@ ivl_type_s* enum_type_t::elaborate_type_raw(Design*, NetScope*scope) const ivl_type_s* vector_type_t::elaborate_type_raw(Design*des, NetScope*scope) const { vector packed; - elaborate_array_ranges(des, scope, packed, pdims.get()); + if (pdims.get()) + evaluate_ranges(des, scope, this, packed, *pdims); netvector_t*tmp = new netvector_t(packed, base_type); tmp->set_signed(signed_flag); @@ -192,7 +155,8 @@ ivl_type_s* string_type_t::elaborate_type_raw(Design*, NetScope*) const ivl_type_s* parray_type_t::elaborate_type_raw(Design*des, NetScope*scope) const { vectorpacked; - elaborate_array_ranges(des, scope, packed, dims.get()); + if (dims.get()) + evaluate_ranges(des, scope, this, packed, *dims); ivl_type_t etype = base_type->elaborate_type(des, scope);