From 07623bef2e5ed158b1a49d5769acd52a498ccdcf Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 21 Jul 2016 19:06:21 +0100 Subject: [PATCH] Fix assignment of outputs from class methods. As for inputs, skip over the implicit 'this' parameter. (cherry picked from commit e316cc708b265f401477b7b7eb667725f47aafca) --- elaborate.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index e8ac6a7fd..8afdeb8b7 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -3817,7 +3817,9 @@ NetProc* PCallTask::elaborate_build_call_(Design*des, NetScope*scope, expression that can be a target to a procedural assignment, including a memory word. */ - for (unsigned idx = 0 ; idx < parm_count ; idx += 1) { + for (unsigned idx = use_this?1:0 ; idx < parm_count ; idx += 1) { + + size_t parms_idx = use_this? idx-1 : idx; NetNet*port = def->port(idx); @@ -3833,12 +3835,12 @@ NetProc* PCallTask::elaborate_build_call_(Design*des, NetScope*scope, message. Note that the elaborate_lval method already printed a detailed message for the latter case. */ NetAssign_*lv = 0; - if (idx < parms_.size() && parms_[idx]) { - lv = parms_[idx]->elaborate_lval(des, scope, false, false); + if (parms_idx < parms_.size() && parms_[parms_idx]) { + lv = parms_[parms_idx]->elaborate_lval(des, scope, false, false); if (lv == 0) { - cerr << parms_[idx]->get_fileline() << ": error: " + cerr << parms_[parms_idx]->get_fileline() << ": error: " << "I give up on task port " << (idx+1) - << " expression: " << *parms_[idx] << endl; + << " expression: " << *parms_[parms_idx] << endl; } } else if (port->port_type() == NetNet::POUTPUT) { // Output ports were skipped earlier, so