kernel: Cell::getParam() to throw exception again if not found

As it did before #1945
This commit is contained in:
Eddie Hung 2020-04-22 12:07:08 -07:00
parent fa9df06c9d
commit 86ab7d3a6e
1 changed files with 2 additions and 3 deletions

View File

@ -2619,16 +2619,15 @@ void RTLIL::Cell::setParam(RTLIL::IdString paramname, RTLIL::Const value)
const RTLIL::Const &RTLIL::Cell::getParam(RTLIL::IdString paramname) const const RTLIL::Const &RTLIL::Cell::getParam(RTLIL::IdString paramname) const
{ {
static const RTLIL::Const empty;
const auto &it = parameters.find(paramname); const auto &it = parameters.find(paramname);
if (it != parameters.end()) if (it != parameters.end())
return it->second; return it->second;
if (module && module->design) { if (module && module->design) {
RTLIL::Module *m = module->design->module(type); RTLIL::Module *m = module->design->module(type);
if (m) if (m)
return m->parameter_default_values.at(paramname, empty); return m->parameter_default_values.at(paramname);
} }
return empty; throw std::out_of_range("Cell::getParam()");
} }
void RTLIL::Cell::sort() void RTLIL::Cell::sort()