Skip to content

Commit 6d9a350

Browse files
committed
remove cast_if_necessary
1 parent 608c5e3 commit 6d9a350

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -317,23 +317,13 @@ static size_t get_variable_slots(const code_typet::parametert &param)
317317
return count_slots(0, param);
318318
}
319319

320-
static bool is_constructor(const class_typet::methodt &method)
320+
bool is_constructor(const class_typet::methodt &method)
321321
{
322322
const std::string &name(id2string(method.get_name()));
323323
const std::string::size_type &npos(std::string::npos);
324324
return npos!=name.find("<init>") || npos!=name.find("<clinit>");
325325
}
326326

327-
static void cast_if_necessary(binary_relation_exprt &condition)
328-
{
329-
exprt &lhs(condition.lhs());
330-
exprt &rhs(condition.rhs());
331-
const typet &lhs_type(lhs.type());
332-
if(lhs_type==rhs.type())
333-
return;
334-
rhs=typecast_exprt(rhs, lhs_type);
335-
}
336-
337327
static irep_idt strip_java_namespace_prefix(const irep_idt to_strip)
338328
{
339329
const auto to_strip_str=id2string(to_strip);
@@ -1600,7 +1590,12 @@ codet java_bytecode_convert_methodt::convert_instructions(
16001590

16011591
binary_relation_exprt condition(op[0], cmp_op, op[1]);
16021592

1603-
cast_if_necessary(condition);
1593+
exprt &lhs(condition.lhs());
1594+
exprt &rhs(condition.rhs());
1595+
const typet &lhs_type(lhs.type());
1596+
if(lhs_type!=rhs.type())
1597+
rhs=typecast_exprt(rhs, lhs_type);
1598+
16041599
code_branch.cond()=condition;
16051600
code_branch.cond().add_source_location()=i_it->source_location;
16061601
code_branch.then_case()=code_gotot(label(number));

0 commit comments

Comments
 (0)