@@ -1822,25 +1822,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1822
1822
{
1823
1823
// use temporary since the stack symbol might get duplicated
1824
1824
PRECONDITION (op.empty () && results.size () == 1 );
1825
- const reference_typet ref_type=java_reference_type (arg0.type ());
1826
- side_effect_exprt java_new_expr (ID_java_new, ref_type);
1827
-
1828
- if (!i_it->source_location .get_line ().empty ())
1829
- java_new_expr.add_source_location ()=i_it->source_location ;
1830
-
1831
- const exprt tmp=tmp_variable (" new" , ref_type);
1832
- c=code_assignt (tmp, java_new_expr);
1833
- c.add_source_location ()=i_it->source_location ;
1834
- codet clinit_call=
1835
- get_clinit_call (to_symbol_type (arg0.type ()).get_identifier ());
1836
- if (clinit_call.get_statement ()!=ID_skip)
1837
- {
1838
- code_blockt ret_block;
1839
- ret_block.move_to_operands (clinit_call);
1840
- ret_block.move_to_operands (c);
1841
- c=std::move (ret_block);
1842
- }
1843
- results[0 ]=tmp;
1825
+ convert_new (i_it, arg0, c, results);
1844
1826
}
1845
1827
else if (statement==" newarray" ||
1846
1828
statement==" anewarray" )
@@ -2402,6 +2384,33 @@ codet java_bytecode_convert_methodt::convert_instructions(
2402
2384
return code;
2403
2385
}
2404
2386
2387
+ void java_bytecode_convert_methodt::convert_new (
2388
+ const source_locationt &location,
2389
+ const exprt &arg0,
2390
+ codet &c,
2391
+ exprt::operandst &results)
2392
+ {
2393
+ const reference_typet ref_type = java_reference_type (arg0.type ());
2394
+ side_effect_exprt java_new_expr (ID_java_new, ref_type);
2395
+
2396
+ if (!location.get_line ().empty ())
2397
+ java_new_expr.add_source_location () = location;
2398
+
2399
+ const exprt tmp = tmp_variable (" new" , ref_type);
2400
+ c = code_assignt (tmp, java_new_expr);
2401
+ c.add_source_location () = location;
2402
+ codet clinit_call =
2403
+ get_clinit_call (to_symbol_type (arg0.type ()).get_identifier ());
2404
+ if (clinit_call.get_statement () != ID_skip)
2405
+ {
2406
+ code_blockt ret_block;
2407
+ ret_block.move_to_operands (clinit_call);
2408
+ ret_block.move_to_operands (c);
2409
+ c = std::move (ret_block);
2410
+ }
2411
+ results[0 ] = tmp;
2412
+ }
2413
+
2405
2414
codet java_bytecode_convert_methodt::convert_putstatic (
2406
2415
const source_locationt &location,
2407
2416
const exprt &arg0,
0 commit comments