Skip to content

Commit 18c2504

Browse files
Use a switch statement for clarity
Replaces repeated if statements on the value of the same variable
1 parent dbd6988 commit 18c2504

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

jbmc/src/java_bytecode/java_bytecode_language.cpp

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -735,36 +735,40 @@ bool java_bytecode_languaget::typecheck(
735735

736736
// Now incrementally elaborate methods
737737
// that are reachable from this entry point.
738-
if(lazy_methods_mode==LAZY_METHODS_MODE_CONTEXT_INSENSITIVE)
738+
switch(lazy_methods_mode)
739739
{
740-
// ci: context-insensitive.
741-
if(do_ci_lazy_method_conversion(symbol_table, method_bytecode))
742-
return true;
743-
}
744-
else if(lazy_methods_mode==LAZY_METHODS_MODE_EAGER)
745-
{
746-
journalling_symbol_tablet journalling_symbol_table =
747-
journalling_symbol_tablet::wrap(symbol_table);
740+
case LAZY_METHODS_MODE_CONTEXT_INSENSITIVE:
741+
// ci = context-insensitive
742+
if(do_ci_lazy_method_conversion(symbol_table, method_bytecode))
743+
return true;
744+
break;
745+
case LAZY_METHODS_MODE_EAGER:
746+
{
747+
journalling_symbol_tablet journalling_symbol_table =
748+
journalling_symbol_tablet::wrap(symbol_table);
748749

749-
// Convert all synthetic methods:
750-
for(const auto &function_id_and_type : synthetic_methods)
751-
{
752-
convert_single_method(
753-
function_id_and_type.first, journalling_symbol_table);
754-
}
755-
// Convert all methods for which we have bytecode now
756-
for(const auto &method_sig : method_bytecode)
757-
{
758-
convert_single_method(method_sig.first, journalling_symbol_table);
759-
}
760-
// Now convert all newly added string methods
761-
for(const auto &fn_name : journalling_symbol_table.get_inserted())
762-
{
763-
if(string_preprocess.implements_function(fn_name))
764-
convert_single_method(fn_name, symbol_table);
765-
}
750+
// Convert all synthetic methods:
751+
for(const auto &function_id_and_type : synthetic_methods)
752+
{
753+
convert_single_method(
754+
function_id_and_type.first, journalling_symbol_table);
755+
}
756+
// Convert all methods for which we have bytecode now
757+
for(const auto &method_sig : method_bytecode)
758+
{
759+
convert_single_method(method_sig.first, journalling_symbol_table);
760+
}
761+
// Now convert all newly added string methods
762+
for(const auto &fn_name : journalling_symbol_table.get_inserted())
763+
{
764+
if(string_preprocess.implements_function(fn_name))
765+
convert_single_method(fn_name, symbol_table);
766+
}
767+
}
768+
break;
769+
default:
770+
// Our caller is in charge of elaborating methods on demand.
766771
}
767-
// Otherwise our caller is in charge of elaborating methods on demand.
768772

769773
// now instrument runtime exceptions
770774
java_bytecode_instrument(

0 commit comments

Comments
 (0)