@@ -63,7 +63,7 @@ class smv_typecheckt:public typecheckt
6363
6464 void create_var_symbols (const smv_parse_treet::modulet::element_listt &);
6565
66- void collect_define (const equal_exprt & );
66+ void collect_define (const exprt &lhs, const exprt &rhs );
6767 void convert_defines (exprt::operandst &invar);
6868 void convert_define (const irep_idt &identifier);
6969
@@ -1959,32 +1959,25 @@ void smv_typecheckt::typecheck(smv_parse_treet::modulet::elementt &element)
19591959 return ;
19601960
19611961 case smv_parse_treet::modulet::elementt::ASSIGN_CURRENT:
1962- typecheck (element.equal_expr ().lhs (), OTHER);
1963- typecheck (element.equal_expr ().rhs (), OTHER);
1964- convert_expr_to (
1965- element.equal_expr ().rhs (), element.equal_expr ().lhs ().type ());
1966- element.equal_expr ().type () = bool_typet{};
1962+ typecheck (element.lhs (), OTHER);
1963+ typecheck (element.rhs (), OTHER);
1964+ convert_expr_to (element.rhs (), element.lhs ().type ());
19671965 return ;
19681966
19691967 case smv_parse_treet::modulet::elementt::ASSIGN_INIT:
1970- typecheck (element.equal_expr ().lhs (), INIT);
1971- typecheck (element.equal_expr ().rhs (), INIT);
1972- convert_expr_to (
1973- element.equal_expr ().rhs (), element.equal_expr ().lhs ().type ());
1974- element.equal_expr ().type () = bool_typet{};
1968+ typecheck (element.lhs (), INIT);
1969+ typecheck (element.rhs (), INIT);
1970+ convert_expr_to (element.rhs (), element.lhs ().type ());
19751971 return ;
19761972
19771973 case smv_parse_treet::modulet::elementt::ASSIGN_NEXT:
1978- typecheck (element.equal_expr ().lhs (), TRANS);
1979- typecheck (element.equal_expr ().rhs (), TRANS);
1980- convert_expr_to (
1981- element.equal_expr ().rhs (), element.equal_expr ().lhs ().type ());
1982- element.equal_expr ().type () = bool_typet{};
1974+ typecheck (element.lhs (), TRANS);
1975+ typecheck (element.rhs (), TRANS);
1976+ convert_expr_to (element.rhs (), element.lhs ().type ());
19831977 return ;
19841978
19851979 case smv_parse_treet::modulet::elementt::DEFINE:
19861980 typecheck (element.expr , OTHER);
1987- element.equal_expr ().type () = bool_typet{};
19881981 return ;
19891982
19901983 case smv_parse_treet::modulet::elementt::ENUM:
@@ -2069,8 +2062,7 @@ void smv_typecheckt::variable_checks(const smv_parse_treet::modulet &module)
20692062 }
20702063 else if (element.is_define ())
20712064 {
2072- const auto &identifier_expr =
2073- to_smv_identifier_expr (to_equal_expr (element.expr ).lhs ());
2065+ const auto &identifier_expr = to_smv_identifier_expr (element.lhs ());
20742066 irep_idt base_name = identifier_expr.identifier ();
20752067
20762068 // already used as enum?
@@ -2194,8 +2186,7 @@ void smv_typecheckt::create_var_symbols(
21942186 }
21952187 else if (element.is_define ())
21962188 {
2197- const auto &identifier_expr =
2198- to_smv_identifier_expr (to_equal_expr (element.expr ).lhs ());
2189+ const auto &identifier_expr = to_smv_identifier_expr (element.lhs ());
21992190 irep_idt base_name = identifier_expr.identifier ();
22002191 irep_idt identifier = module + " ::var::" + id2string (base_name);
22012192
@@ -2256,11 +2247,8 @@ Function: smv_typecheckt::collect_define
22562247
22572248\*******************************************************************/
22582249
2259- void smv_typecheckt::collect_define (const equal_exprt &expr )
2250+ void smv_typecheckt::collect_define (const exprt &lhs, const exprt &rhs )
22602251{
2261- const exprt &lhs = expr.lhs ();
2262- const exprt &rhs = expr.rhs ();
2263-
22642252 if (lhs.id () != ID_symbol)
22652253 throw errort () << " collect_define expects symbol on left hand side" ;
22662254
@@ -2286,9 +2274,9 @@ void smv_typecheckt::collect_define(const equal_exprt &expr)
22862274
22872275 if (!result.second )
22882276 {
2289- throw errort ().with_location (expr. find_source_location ())
2277+ throw errort ().with_location (lhs. source_location ())
22902278 << " variable `" << symbol.display_name () << " ' already defined" ;
2291- }
2279+ }
22922280}
22932281
22942282/* ******************************************************************\
@@ -2416,7 +2404,7 @@ void smv_typecheckt::convert(smv_parse_treet::modulet &smv_module)
24162404 for (auto &element : smv_module.elements )
24172405 {
24182406 if (element.is_define () || element.is_assign_current ())
2419- collect_define (element.equal_expr ());
2407+ collect_define (element.lhs (), element. rhs ());
24202408 }
24212409 // now turn them into INVARs
24222410 convert_defines (trans_invar);
0 commit comments