@@ -402,55 +402,59 @@ inline verilog_set_genvarst &to_verilog_set_genvars(exprt &expr)
402402 return static_cast <verilog_set_genvarst &>(expr);
403403}
404404
405- class verilog_parameter_declt : public verilog_module_itemt
405+ // This class is used for all declarators in the parse tree
406+ class verilog_declaratort : public exprt
406407{
407408public:
408- inline verilog_parameter_declt () : verilog_module_itemt(ID_parameter_decl)
409+ const irep_idt & identifier () const
409410 {
411+ return get (ID_identifier);
410412 }
411413
412- class declaratort : public exprt
414+ void identifier (irep_idt _identifier)
413415 {
414- public:
415- const irep_idt &identifier () const
416- {
417- return get (ID_identifier);
418- }
416+ set (ID_identifier, _identifier);
417+ }
419418
420- void identifier ( irep_idt _identifier)
421- {
422- set (ID_identifier, _identifier );
423- }
419+ const irep_idt & base_name () const
420+ {
421+ return get (ID_base_name );
422+ }
424423
425- const irep_idt & base_name () const
426- {
427- return get (ID_base_name );
428- }
424+ const exprt & value () const
425+ {
426+ return static_cast < const exprt &>( find (ID_value) );
427+ }
429428
430- const exprt &value () const
431- {
432- return static_cast <const exprt &>(find (ID_value));
433- }
429+ exprt &value ()
430+ {
431+ return static_cast <exprt &>(add (ID_value));
432+ }
434433
435- exprt & value ()
436- {
437- return static_cast <exprt &>( add ( ID_value));
438- }
434+ bool has_value () const
435+ {
436+ return find ( ID_value). is_not_nil ( );
437+ }
439438
440- bool has_value () const
441- {
442- return find (ID_value).is_not_nil ();
443- }
439+ // helper to generate a symbol expression
440+ symbol_exprt symbol_expr () const
441+ {
442+ return symbol_exprt (identifier (), type ())
443+ .with_source_location <symbol_exprt>(*this );
444+ }
445+ };
444446
445- // helper to generate a symbol expression
446- symbol_exprt symbol_expr () const
447- {
448- return symbol_exprt (identifier (), type ())
449- .with_source_location <symbol_exprt>(*this );
450- }
451- };
447+ using verilog_declaratorst = std::vector<verilog_declaratort>;
448+
449+ class verilog_parameter_declt : public verilog_module_itemt
450+ {
451+ public:
452+ inline verilog_parameter_declt () : verilog_module_itemt(ID_parameter_decl)
453+ {
454+ }
452455
453- using declaratorst = std::vector<declaratort>;
456+ using declaratort = verilog_declaratort;
457+ using declaratorst = verilog_declaratorst;
454458
455459 const declaratorst &declarations () const
456460 {
@@ -484,8 +488,8 @@ class verilog_local_parameter_declt : public verilog_module_itemt
484488 {
485489 }
486490
487- using declaratort = verilog_parameter_declt::declaratort ;
488- using declaratorst = std::vector<declaratort> ;
491+ using declaratort = verilog_declaratort ;
492+ using declaratorst = verilog_declaratorst ;
489493
490494 const declaratorst &declarations () const
491495 {
@@ -516,7 +520,7 @@ class verilog_lett : public verilog_module_itemt
516520{
517521public:
518522 // These have a single declarator.
519- using declaratort = verilog_parameter_declt::declaratort ;
523+ using declaratort = verilog_declaratort ;
520524
521525 const declaratort &declarator () const
522526 {
@@ -700,8 +704,8 @@ class verilog_declt:public verilog_statementt
700704 }
701705
702706 // When it's not a function or task, there are declarators.
703- using declaratort = verilog_parameter_declt::declaratort ;
704- using declaratorst = verilog_parameter_declt::declaratorst ;
707+ using declaratort = verilog_declaratort ;
708+ using declaratorst = verilog_declaratorst ;
705709
706710 declaratorst &declarators ()
707711 {
0 commit comments