Implement `has_aa_term()` for cast expressions
If the base expression of a cast expression has an automatic term then the cast expression itself has an automatic term. Make sure this is implemented so that an error is properly reported when using such an expression in a context where automatic variables are not allowed. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
2bb1489f92
commit
c9e7aecf1d
15
PExpr.cc
15
PExpr.cc
|
|
@ -142,6 +142,11 @@ PECastSize::~PECastSize()
|
|||
{
|
||||
}
|
||||
|
||||
bool PECastSize::has_aa_term(Design *des, NetScope *scope) const
|
||||
{
|
||||
return base_->has_aa_term(des, scope);
|
||||
}
|
||||
|
||||
PECastType::PECastType(data_type_t*t, PExpr*b)
|
||||
: target_(t), base_(b)
|
||||
{
|
||||
|
|
@ -151,12 +156,22 @@ PECastType::~PECastType()
|
|||
{
|
||||
}
|
||||
|
||||
bool PECastType::has_aa_term(Design *des, NetScope *scope) const
|
||||
{
|
||||
return base_->has_aa_term(des, scope);
|
||||
}
|
||||
|
||||
PECastSign::PECastSign(bool signed_flag, PExpr *base)
|
||||
: base_(base)
|
||||
{
|
||||
signed_flag_ = signed_flag;
|
||||
}
|
||||
|
||||
bool PECastSign::has_aa_term(Design *des, NetScope *scope) const
|
||||
{
|
||||
return base_->has_aa_term(des, scope);
|
||||
}
|
||||
|
||||
PEBComp::PEBComp(char op, PExpr*l, PExpr*r)
|
||||
: PEBinary(op, l, r)
|
||||
{
|
||||
|
|
|
|||
6
PExpr.h
6
PExpr.h
|
|
@ -972,6 +972,8 @@ class PECastSize : public PExpr {
|
|||
unsigned expr_wid,
|
||||
unsigned flags) const;
|
||||
|
||||
virtual bool has_aa_term(Design *des, NetScope *scope) const;
|
||||
|
||||
virtual unsigned test_width(Design*des, NetScope*scope,
|
||||
width_mode_t&mode);
|
||||
|
||||
|
|
@ -997,6 +999,8 @@ class PECastType : public PExpr {
|
|||
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope,
|
||||
unsigned expr_wid, unsigned flags) const;
|
||||
|
||||
virtual bool has_aa_term(Design *des, NetScope *scope) const;
|
||||
|
||||
virtual unsigned test_width(Design*des, NetScope*scope,
|
||||
width_mode_t&mode);
|
||||
|
||||
|
|
@ -1020,6 +1024,8 @@ class PECastSign : public PExpr {
|
|||
NetExpr* elaborate_expr(Design *des, NetScope *scope,
|
||||
unsigned expr_wid, unsigned flags) const;
|
||||
|
||||
virtual bool has_aa_term(Design *des, NetScope *scope) const;
|
||||
|
||||
unsigned test_width(Design *des, NetScope *scope, width_mode_t &mode);
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in New Issue