@@ -75,22 +75,42 @@ void verilog_typecheckt::collect_symbols(
7575
7676 auto full_identifier = hierarchical_identifier (base_name);
7777
78- // If there's no type, parameters take the type of the
79- // value. We signal this using the special type "derive_from_value".
78+ // Is this a type or a value parameter?
79+ if (type.id () == ID_type)
80+ {
81+ // much like a typedef
82+ auto symbol_type = to_be_elaborated_typet{declarator.type ()};
8083
81- auto symbol_type =
82- to_be_elaborated_typet (type.is_nil () ? derive_from_value_typet () : type);
84+ type_symbolt symbol{full_identifier, symbol_type, mode};
8385
84- symbolt symbol{full_identifier, symbol_type, mode};
86+ symbol.module = module_identifier;
87+ symbol.base_name = base_name;
88+ symbol.pretty_name = strip_verilog_prefix (symbol.name );
89+ symbol.is_macro = true ;
90+ symbol.value = nil_exprt{};
91+ symbol.location = declarator.source_location ();
92+
93+ add_symbol (std::move (symbol));
94+ }
95+ else // It's a value parameter.
96+ {
97+ // If there's no type, parameters take the type of the
98+ // value. We signal this using the special type "derive_from_value".
8599
86- symbol.module = module_identifier;
87- symbol.base_name = base_name;
88- symbol.pretty_name = strip_verilog_prefix (symbol.name );
89- symbol.is_macro = true ;
90- symbol.value = declarator.value ();
91- symbol.location = declarator.source_location ();
100+ auto symbol_type =
101+ to_be_elaborated_typet (type.is_nil () ? derive_from_value_typet () : type);
92102
93- add_symbol (std::move (symbol));
103+ symbolt symbol{full_identifier, symbol_type, mode};
104+
105+ symbol.module = module_identifier;
106+ symbol.base_name = base_name;
107+ symbol.pretty_name = strip_verilog_prefix (symbol.name );
108+ symbol.is_macro = true ;
109+ symbol.value = declarator.value ();
110+ symbol.location = declarator.source_location ();
111+
112+ add_symbol (std::move (symbol));
113+ }
94114}
95115
96116void verilog_typecheckt::collect_symbols (const typet &type)
0 commit comments