11
11
12
12
#include " java_bytecode_typecheck.h"
13
13
14
+ #include < util/invariant.h>
14
15
#include < util/std_types.h>
15
16
16
17
void java_bytecode_typecheckt::typecheck_type (typet &type)
@@ -19,17 +20,12 @@ void java_bytecode_typecheckt::typecheck_type(typet &type)
19
20
{
20
21
irep_idt identifier=to_symbol_type (type).get_identifier ();
21
22
22
- symbol_tablet::symbolst::const_iterator s_it=
23
- symbol_table.symbols .find (identifier);
24
-
25
- // must exist already in the symbol table
26
- if (s_it==symbol_table.symbols .end ())
27
- {
28
- error () << " failed to find type symbol " << identifier << eom;
29
- throw 0 ;
30
- }
31
-
32
- assert (s_it->second .is_type );
23
+ auto type_symbol = symbol_table.lookup (identifier);
24
+ DATA_INVARIANT (
25
+ type_symbol, " symbol " + id2string (identifier) + " must exist already" );
26
+ DATA_INVARIANT (
27
+ type_symbol->is_type ,
28
+ " symbol " + id2string (identifier) + " must be a type" );
33
29
}
34
30
else if (type.id ()==ID_pointer)
35
31
{
@@ -55,7 +51,8 @@ void java_bytecode_typecheckt::typecheck_type(typet &type)
55
51
56
52
void java_bytecode_typecheckt::typecheck_type_symbol (symbolt &symbol)
57
53
{
58
- assert (symbol.is_type );
54
+ DATA_INVARIANT (
55
+ symbol.is_type , " symbol " + id2string (symbol.name ) + " must be a type" );
59
56
60
57
symbol.mode = ID_java;
61
58
typecheck_type (symbol.type );
0 commit comments