File tree Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -1422,9 +1422,11 @@ class verilog_module_sourcet : public irept
1422
1422
return (parameter_port_listt &)(add (ID_parameter_port_list).get_sub ());
1423
1423
}
1424
1424
1425
- const exprt::operandst &ports () const
1425
+ using port_listt = std::vector<verilog_declt>;
1426
+
1427
+ const port_listt &ports () const
1426
1428
{
1427
- return (const exprt::operandst &)(find (ID_ports).get_sub ());
1429
+ return (const port_listt &)(find (ID_ports).get_sub ());
1428
1430
}
1429
1431
1430
1432
using module_itemst = std::vector<class verilog_module_itemt >;
Original file line number Diff line number Diff line change @@ -61,26 +61,22 @@ void verilog_typecheckt::check_module_ports(
61
61
62
62
unsigned nr=0 ;
63
63
64
- for (auto &port : module_ports)
64
+ for (auto &decl : module_ports)
65
65
{
66
- assert (port.id () == ID_decl);
66
+ DATA_INVARIANT (decl.id () == ID_decl, " port declaration id" );
67
+ DATA_INVARIANT (
68
+ decl.declarators ().size () == 1 ,
69
+ " port declarations must have one declarator" );
67
70
68
- const verilog_declt &decl = to_verilog_decl (port );
71
+ const auto &declarator = decl. declarators (). front ( );
69
72
70
- assert (decl.operands ().size ()==1 );
71
- const auto &declarator = to_unary_expr (decl).op ();
72
- assert (declarator.id () == ID_symbol);
73
+ const irep_idt &name = declarator.identifier ();
74
+ const irep_idt &port_class = decl.get_class ();
73
75
74
- const irep_idt &name = to_symbol_expr (declarator).get_identifier ();
75
- const irep_idt &port_class=decl.get (ID_class);
76
-
77
76
if (name.empty ())
78
77
{
79
- error ().source_location =
80
- static_cast <const exprt &>(port).source_location ();
81
- error () << " empty port name (module "
82
- << module_symbol.base_name << ' )' << eom;
83
- throw 0 ;
78
+ throw errort ().with_location (decl.source_location ())
79
+ << " empty port name (module " << module_symbol.base_name << ' )' ;
84
80
}
85
81
86
82
if (port_names.find (name)!=
You can’t perform that action at this time.
0 commit comments