From c24c26725e7ce41fbd88d471ab55db92ca0f45b1 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 25 Aug 2014 18:03:11 -0700 Subject: [PATCH] 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. --- elaborate.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index a9743834b..4413f22de 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -3440,10 +3440,15 @@ NetProc* PCallTask::elaborate_sys_task_method_(Design*des, NetScope*scope, NetESignal*sig = new NetESignal(net); sig->set_line(*this); - vectorargv (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; + + vectorargv (1 + nparms); argv[0] = sig; - for (unsigned idx = 0 ; idx < parms_.size() ; idx += 1) { + for (unsigned idx = 0 ; idx < nparms ; idx += 1) { PExpr*ex = parms_[idx]; if (ex != 0) { argv[idx+1] = elab_sys_task_arg(des, scope,