@@ -54,6 +54,56 @@ class patternt
54
54
const char *p;
55
55
};
56
56
57
+ /* ******************************************************************\
58
+
59
+ Function: assign_parameter_names
60
+
61
+ Inputs: `ftype`: Function type whose parameters should be named
62
+ `name_prefix`: Prefix for parameter names, typically the
63
+ parent function's name.
64
+ `symbol_table`: Global symbol table
65
+
66
+ Outputs: Assigns parameter names (side-effects on `ftype`) to
67
+ function stub parameters, which are initially nameless
68
+ as method conversion hasn't happened.
69
+ Also creates symbols in `symbol_table`.
70
+
71
+ Purpose: See above
72
+
73
+ \*******************************************************************/
74
+
75
+ void assign_parameter_names (
76
+ code_typet &ftype,
77
+ const irep_idt &name_prefix,
78
+ symbol_tablet &symbol_table)
79
+ {
80
+ code_typet::parameterst ¶meters=ftype.parameters ();
81
+
82
+ // Mostly borrowed from java_bytecode_convert.cpp; maybe factor this out.
83
+ // assign names to parameters
84
+ for (std::size_t i=0 ; i<parameters.size (); ++i)
85
+ {
86
+ irep_idt base_name, identifier;
87
+
88
+ if (i==0 && parameters[i].get_this ())
89
+ base_name=" this" ;
90
+ else
91
+ base_name=" stub_ignored_arg" +std::to_string (i);
92
+
93
+ identifier=id2string (name_prefix)+" ::" +id2string (base_name);
94
+ parameters[i].set_base_name (base_name);
95
+ parameters[i].set_identifier (identifier);
96
+
97
+ // add to symbol table
98
+ parameter_symbolt parameter_symbol;
99
+ parameter_symbol.base_name =base_name;
100
+ parameter_symbol.mode =ID_java;
101
+ parameter_symbol.name =identifier;
102
+ parameter_symbol.type =parameters[i].type ();
103
+ symbol_table.add (parameter_symbol);
104
+ }
105
+ }
106
+
57
107
static bool operator ==(const irep_idt &what, const patternt &pattern)
58
108
{
59
109
return pattern==what;
@@ -1216,9 +1266,18 @@ codet java_bytecode_convert_methodt::convert_instructions(
1216
1266
symbolt symbol;
1217
1267
symbol.name =id;
1218
1268
symbol.base_name =arg0.get (ID_C_base_name);
1269
+ symbol.pretty_name =
1270
+ id2string (arg0.get (ID_C_class)).substr (6 )+" ." +
1271
+ id2string (symbol.base_name )+" ()" ;
1219
1272
symbol.type =arg0.type ();
1220
1273
symbol.value .make_nil ();
1221
1274
symbol.mode =ID_java;
1275
+
1276
+ assign_parameter_names (
1277
+ to_code_type (symbol.type ),
1278
+ symbol.name ,
1279
+ symbol_table);
1280
+
1222
1281
symbol_table.add (symbol);
1223
1282
}
1224
1283
0 commit comments