A method call needs to ignore a single NULL argument from the parser

The parser always passes a single NULL argument for system tasks. For a
method call which will add a signal to call the method on we need to
ignore this NULL argument.
This commit is contained in:
Cary R 2014-08-25 18:03:11 -07:00
parent 1269c12054
commit c24c26725e
1 changed files with 7 additions and 2 deletions

View File

@ -3440,10 +3440,15 @@ NetProc* PCallTask::elaborate_sys_task_method_(Design*des, NetScope*scope,
NetESignal*sig = new NetESignal(net); NetESignal*sig = new NetESignal(net);
sig->set_line(*this); sig->set_line(*this);
vector<NetExpr*>argv (1 + parms_.size()); /* If there is a single NULL argument then ignore it since it is
* left over from the parser and is not needed by the method. */
unsigned nparms = parms_.size();
if ((nparms == 1) && (parms_[0] == 0)) nparms = 0;
vector<NetExpr*>argv (1 + nparms);
argv[0] = sig; argv[0] = sig;
for (unsigned idx = 0 ; idx < parms_.size() ; idx += 1) { for (unsigned idx = 0 ; idx < nparms ; idx += 1) {
PExpr*ex = parms_[idx]; PExpr*ex = parms_[idx];
if (ex != 0) { if (ex != 0) {
argv[idx+1] = elab_sys_task_arg(des, scope, argv[idx+1] = elab_sys_task_arg(des, scope,