Enforce that l-value of contribution is an access function.

This commit is contained in:
Stephen Williams 2008-11-03 21:58:16 -08:00
parent eb240ddb73
commit 0d88d3a798
3 changed files with 13 additions and 4 deletions

View File

@ -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;
}

View File

@ -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)
{
}

View File

@ -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_;
};