Skip to content

Commit 7520078

Browse files
Replace lookup_ref call by lookup
This code doesn't need a writable reference so it should call lookup instead. We also add an invariant to check that the reference does exists, this gives more helpful messages than the generic `_Map_base::at`.
1 parent 8c7ee00 commit 7520078

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

jbmc/src/java_bytecode/assignments_from_json.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,9 @@ void assign_from_json(
838838
location.set_function(function_id);
839839
allocate_objectst allocate(ID_java, location, function_id, symbol_table);
840840
code_blockt body_rec;
841-
const auto class_name = declaring_class(symbol_table.lookup_ref(function_id));
841+
const symbolt *function_symbol = symbol_table.lookup(function_id);
842+
INVARIANT(function_symbol, "Function must appear in symbol table");
843+
const auto class_name = declaring_class(*function_symbol);
842844
INVARIANT(
843845
class_name,
844846
"Function " + id2string(function_id) + " must be declared by a class.");

0 commit comments

Comments
 (0)