ivl_type_s: Add get_scalar() method
Currently only the netvector_t type implements the get_scalar() method. To check whether a type is scalar it is first cast to netvector_t and then the method is called. But there are other types, such as areal that can also be scalar. To support indicating that a real type is scalar add a virtual get_scalar() method to ivl_type_s, which is the base class for all types. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
f3c4967085
commit
6f0d3ae332
|
|
@ -715,10 +715,8 @@ bool NetNet::get_signed() const
|
|||
|
||||
bool NetNet::get_scalar() const
|
||||
{
|
||||
if (const netvector_t*vec = dynamic_cast<const netvector_t*> (net_type_))
|
||||
return vec->get_scalar();
|
||||
else
|
||||
return false;
|
||||
ivl_assert(*this, net_type_);
|
||||
return net_type_->get_scalar();
|
||||
}
|
||||
|
||||
const netenum_t*NetNet::enumeration(void) const
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ bool ivl_type_s::get_signed() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ivl_type_s::get_scalar() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ivl_type_s::type_compatible(ivl_type_t that) const
|
||||
{
|
||||
if (this == that)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class ivl_type_s {
|
|||
// those specific types.
|
||||
virtual ivl_variable_type_t base_type() const;
|
||||
virtual bool get_signed() const;
|
||||
virtual bool get_scalar() const;
|
||||
|
||||
// Return true if "that" type is compatible with this
|
||||
// type. Compatible means the types are essentially the same.
|
||||
|
|
|
|||
Loading…
Reference in New Issue