Handle errors in parameter handling.

Don't crash if the user typed in an invalid parameter.
This commit is contained in:
Stephen Williams 2008-12-19 16:32:44 -08:00
parent d1ce6d2535
commit 33044876dd
2 changed files with 10 additions and 2 deletions

View File

@ -1118,7 +1118,11 @@ void NetScope::dump(ostream&o) const
o << "[" << *(*pp).second.msb
<< ":" << *(*pp).second.lsb << "] ";
o << (*pp).first << " = " << *(*pp).second.expr;
o << (*pp).first << " = ";
if (pp->second.expr)
o << *(*pp).second.expr;
else
o << "<nil>";
for (range_t*ran = (*pp).second.range ; ran ; ran = ran->next) {
if (ran->exclude_flag)

View File

@ -590,6 +590,10 @@ void NetScope::evaluate_parameters(Design*des)
for (param_ref_t cur = parameters.begin()
; cur != parameters.end() ; cur ++) {
// Resolve the expression type (signed/unsigned) if the
// expression is present. It is possible to not be
// present if there are earlier errors en elaboration.
if (cur->second.expr)
cur->second.expr->resolve_pexpr_type();
switch ((*cur).second.type) {