File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -148,12 +148,29 @@ void java_simple_method_stubst::create_method_stub_at(
148
148
void java_simple_method_stubst::create_method_stub (symbolt &symbol)
149
149
{
150
150
code_blockt new_instructions;
151
- const java_method_typet &required_type = to_java_method_type (symbol.type );
151
+ java_method_typet &required_type = to_java_method_type (symbol.type );
152
152
153
153
// synthetic source location that contains the opaque function name only
154
154
source_locationt synthesized_source_location;
155
155
synthesized_source_location.set_function (symbol.name );
156
156
157
+ // make sure all parameters are named
158
+ for (auto ¶meter : required_type.parameters ())
159
+ {
160
+ if (parameter.get_identifier ().empty ())
161
+ {
162
+ symbolt ¶meter_symbol = fresh_java_symbol (
163
+ parameter.type (),
164
+ " #anon" ,
165
+ synthesized_source_location,
166
+ symbol.name ,
167
+ symbol_table);
168
+ parameter_symbol.is_parameter = true ;
169
+ parameter.set_base_name (parameter_symbol.base_name );
170
+ parameter.set_identifier (parameter_symbol.name );
171
+ }
172
+ }
173
+
157
174
// Initialize the return value or `this` parameter under construction.
158
175
// Note symbol.type is required_type, but with write access
159
176
// Probably required_type should not be const
Original file line number Diff line number Diff line change @@ -159,6 +159,15 @@ void goto_convert_functionst::convert_function(
159
159
symbol.is_compiled ()) /* goto_inline may have removed the body */
160
160
return ;
161
161
162
+ // we have a body, make sure all parameter names are valid
163
+ for (const auto &p : f.parameter_identifiers )
164
+ {
165
+ DATA_INVARIANT (!p.empty (), " parameter identifier should not be empty" );
166
+ DATA_INVARIANT (
167
+ symbol_table.has_symbol (p),
168
+ " parameter identifier must be a known symbol" );
169
+ }
170
+
162
171
lifetimet parent_lifetime = lifetime;
163
172
lifetime = identifier == INITIALIZE_FUNCTION ? lifetimet::STATIC_GLOBAL
164
173
: lifetimet::AUTOMATIC_LOCAL;
You can’t perform that action at this time.
0 commit comments