Skip to content

Commit 1273eac

Browse files
author
Daniel Kroening
authored
Merge pull request #2804 from NathanJPhillips/cleanup/switch-lazy-mode
Use a switch statement for clarity
2 parents 93b3e9c + 667738a commit 1273eac

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

jbmc/src/java_bytecode/java_bytecode_language.cpp

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -741,36 +741,41 @@ bool java_bytecode_languaget::typecheck(
741741

742742
// Now incrementally elaborate methods
743743
// that are reachable from this entry point.
744-
if(lazy_methods_mode==LAZY_METHODS_MODE_CONTEXT_INSENSITIVE)
744+
switch(lazy_methods_mode)
745745
{
746-
// ci: context-insensitive.
747-
if(do_ci_lazy_method_conversion(symbol_table, method_bytecode))
748-
return true;
749-
}
750-
else if(lazy_methods_mode==LAZY_METHODS_MODE_EAGER)
751-
{
752-
journalling_symbol_tablet journalling_symbol_table =
753-
journalling_symbol_tablet::wrap(symbol_table);
746+
case LAZY_METHODS_MODE_CONTEXT_INSENSITIVE:
747+
// ci = context-insensitive
748+
if(do_ci_lazy_method_conversion(symbol_table, method_bytecode))
749+
return true;
750+
break;
751+
case LAZY_METHODS_MODE_EAGER:
752+
{
753+
journalling_symbol_tablet journalling_symbol_table =
754+
journalling_symbol_tablet::wrap(symbol_table);
754755

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

775780
// now instrument runtime exceptions
776781
java_bytecode_instrument(

0 commit comments

Comments
 (0)