vhdlpp: VTypeArray stores parent type, in case it is a subtype.
This commit is contained in:
parent
9ba7694484
commit
774609fbbb
|
|
@ -105,6 +105,7 @@ static const VType* calculate_subtype_array(const YYLTYPE&loc, const char*base_n
|
|||
|
||||
VTypeArray*subtype = new VTypeArray(element, range,
|
||||
base_array->signed_vector());
|
||||
subtype->set_parent_type(base_array);
|
||||
return subtype;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void VTypePrimitive::show(ostream&out) const
|
|||
}
|
||||
|
||||
VTypeArray::VTypeArray(const VType*element, const vector<VTypeArray::range_t>&r, bool sv)
|
||||
: etype_(element), ranges_(r), signed_flag_(sv)
|
||||
: etype_(element), ranges_(r), signed_flag_(sv), parent_(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ VTypeArray::VTypeArray(const VType*element, const vector<VTypeArray::range_t>&r,
|
|||
* this is a memory leak. Something to fix.
|
||||
*/
|
||||
VTypeArray::VTypeArray(const VType*element, std::list<prange_t*>*r, bool sv)
|
||||
: etype_(element), ranges_(r->size()), signed_flag_(sv)
|
||||
: etype_(element), ranges_(r->size()), signed_flag_(sv), parent_(NULL)
|
||||
{
|
||||
for (size_t idx = 0 ; idx < ranges_.size() ; idx += 1) {
|
||||
prange_t*curp = r->front();
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ class VTypeArray : public VType {
|
|||
inline bool signed_vector() const { return signed_flag_; }
|
||||
|
||||
// returns the type of element held in the array
|
||||
inline const VType* element_type() const { return etype_; }
|
||||
inline const VType* element_type() const { return parent_ ? parent_->element_type() : etype_; }
|
||||
|
||||
// returns the basic type of element held in the array
|
||||
// (unfolds typedefs and multidimensional arrays)
|
||||
|
|
@ -227,6 +227,9 @@ class VTypeArray : public VType {
|
|||
|
||||
bool is_unbounded() const;
|
||||
|
||||
// To handle subtypes
|
||||
inline void set_parent_type(const VTypeArray*parent) { parent_ = parent; }
|
||||
|
||||
private:
|
||||
int emit_with_dims_(std::ostream&out, bool packed, perm_string name) const;
|
||||
|
||||
|
|
@ -235,6 +238,7 @@ class VTypeArray : public VType {
|
|||
|
||||
std::vector<range_t> ranges_;
|
||||
bool signed_flag_;
|
||||
const VTypeArray*parent_;
|
||||
};
|
||||
|
||||
class VTypeRange : public VType {
|
||||
|
|
|
|||
Loading…
Reference in New Issue