diff --git a/elab_expr.cc b/elab_expr.cc index 0a5e31536..3ba58ef03 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -5091,8 +5091,7 @@ NetExpr* PEIdent::elaborate_expr_param_bit_(Design*des, NetScope*scope, /* Create a parameter reference for the variable select. */ NetEConstParam*ptmp = new NetEConstParam(found_in, name, par_ex->value()); - NetScope::param_ref_t pref = found_in->find_parameter(name); - ptmp->set_line((*pref).second); + ptmp->set_line(found_in->get_parameter_line_info(name)); NetExpr*tmp = new NetESelect(ptmp, sel, 1); tmp->set_line(*this); @@ -5298,8 +5297,7 @@ NetExpr* PEIdent::elaborate_expr_param_idx_up_(Design*des, NetScope*scope, /* Create a parameter reference for the variable select. */ NetEConstParam*ptmp = new NetEConstParam(found_in, name, par_ex->value()); - NetScope::param_ref_t pref = found_in->find_parameter(name); - ptmp->set_line((*pref).second); + ptmp->set_line(found_in->get_parameter_line_info(name)); NetExpr*tmp = new NetESelect(ptmp, base, wid, IVL_SEL_IDX_UP); tmp->set_line(*this); @@ -5380,8 +5378,7 @@ NetExpr* PEIdent::elaborate_expr_param_idx_do_(Design*des, NetScope*scope, /* Create a parameter reference for the variable select. */ NetEConstParam*ptmp = new NetEConstParam(found_in, name, par_ex->value()); - NetScope::param_ref_t pref = found_in->find_parameter(name); - ptmp->set_line((*pref).second); + ptmp->set_line(found_in->get_parameter_line_info(name)); NetExpr*tmp = new NetESelect(ptmp, base, wid, IVL_SEL_IDX_DOWN); tmp->set_line(*this); @@ -5500,8 +5497,7 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des, /* The numeric parameter value needs to have the file and line * information for the actual parameter not the expression. */ assert(tmp); - NetScope::param_ref_t pref = found_in->find_parameter(name); - tmp->set_line((*pref).second); + tmp->set_line(found_in->get_parameter_line_info(name)); } return tmp; diff --git a/net_scope.cc b/net_scope.cc index 61ca017d4..2e6a60366 100644 --- a/net_scope.cc +++ b/net_scope.cc @@ -460,18 +460,18 @@ const NetExpr* NetScope::get_parameter(Design*des, perm_string key, return tmp; } -NetScope::param_ref_t NetScope::find_parameter(perm_string key) +LineInfo NetScope::get_parameter_line_info(perm_string key) const { - map::iterator idx; + map::const_iterator idx; idx = parameters.find(key); - if (idx != parameters.end()) return idx; + if (idx != parameters.end()) return idx->second; // To get here the parameter must already exist, so we should // never get here. assert(0); // But return something to avoid a compiler warning. - return idx; + return LineInfo(); } void NetScope::print_type(ostream&stream) const diff --git a/netlist.h b/netlist.h index 66268b93e..68514c3e6 100644 --- a/netlist.h +++ b/netlist.h @@ -1239,7 +1239,7 @@ class NetScope : public Definitions, public Attrib { typedef std::map::iterator param_ref_t; - param_ref_t find_parameter(perm_string name); + LineInfo get_parameter_line_info(perm_string name) const; /* Module instance arrays are collected here for access during the multiple elaboration passes. */