mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-29 09:09:58 +02:00
Improve error reporting for unnamed module ports.
Implicit ports may be unnamed, either because the port expression is not a simple/escaped identifier, or because there is no port expression. To handle these cases, error messages should report the port position as well as the port name.
This commit is contained in:
@@ -94,13 +94,15 @@ perm_string Module::get_port_name(unsigned idx) const
|
||||
{
|
||||
|
||||
assert(idx < ports.size());
|
||||
if (ports[idx] == 0) {
|
||||
if (ports[idx] == 0 || ports[idx]->name.str() == 0) {
|
||||
/* It is possible to have undeclared ports. These
|
||||
are ports that are skipped in the declaration,
|
||||
for example like so: module foo(x ,, y); The
|
||||
port between x and y is unnamed and thus
|
||||
inaccessible to binding by name. */
|
||||
return perm_string::literal("");
|
||||
inaccessible to binding by name. Port references
|
||||
that aren't simple or escaped identifiers are
|
||||
also inaccessible to binding by name. */
|
||||
return perm_string::literal("unnamed");
|
||||
}
|
||||
return ports[idx]->name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user