Enforce that l-value of contribution is an access function.
This commit is contained in:
parent
eb240ddb73
commit
0d88d3a798
|
|
@ -31,7 +31,15 @@ NetProc* AContrib::elaborate(Design*des, NetScope*scope) const
|
|||
NetExpr*lval = elab_and_eval(des, scope, lval_, -1);
|
||||
NetExpr*rval = elab_and_eval(des, scope, rval_, -1);
|
||||
|
||||
NetContribution*st = new NetContribution(lval, rval);
|
||||
NetEAccess*lacc = dynamic_cast<NetEAccess*> (lval);
|
||||
if (lacc == 0) {
|
||||
cerr << get_fileline() << ": error: The l-value of a contribution"
|
||||
<< " statement must be a branch probe access function." << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NetContribution*st = new NetContribution(lacc, rval);
|
||||
st->set_line(*this);
|
||||
return st;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
# include "netmisc.h"
|
||||
# include "ivl_assert.h"
|
||||
|
||||
NetContribution::NetContribution(NetExpr*l, NetExpr*r)
|
||||
NetContribution::NetContribution(NetEAccess*l, NetExpr*r)
|
||||
: lval_(l), rval_(r)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ class NetRelease;
|
|||
class NetScope;
|
||||
class NetEvProbe;
|
||||
class NetExpr;
|
||||
class NetEAccess;
|
||||
class NetESignal;
|
||||
class NetFuncDef;
|
||||
class NetRamDq;
|
||||
|
|
@ -2435,13 +2436,13 @@ class NetCondit : public NetProc {
|
|||
class NetContribution : public NetProc {
|
||||
|
||||
public:
|
||||
explicit NetContribution(NetExpr*lval, NetExpr*rval);
|
||||
explicit NetContribution(NetEAccess*lval, NetExpr*rval);
|
||||
~NetContribution();
|
||||
|
||||
virtual void dump(ostream&, unsigned ind) const;
|
||||
|
||||
private:
|
||||
NetExpr*lval_;
|
||||
NetEAccess*lval_;
|
||||
NetExpr*rval_;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue