@@ -62,7 +62,7 @@ class smv_typecheckt:public typecheckt
6262
6363 void create_var_symbols (const smv_parse_treet::modulet::element_listt &);
6464
65- void collect_define (const equal_exprt & );
65+ void collect_define (const exprt &lhs, const exprt &rhs );
6666 void convert_defines (exprt::operandst &invar);
6767 void convert_define (const irep_idt &identifier);
6868
@@ -1966,33 +1966,26 @@ void smv_typecheckt::typecheck(smv_parse_treet::modulet::elementt &element)
19661966 return ;
19671967
19681968 case smv_parse_treet::modulet::elementt::ASSIGN_CURRENT:
1969- typecheck (element.equal_expr ().lhs (), OTHER);
1970- typecheck (element.equal_expr ().rhs (), OTHER);
1971- convert_expr_to (
1972- element.equal_expr ().rhs (), element.equal_expr ().lhs ().type ());
1973- element.equal_expr ().type () = bool_typet{};
1969+ typecheck (element.lhs (), OTHER);
1970+ typecheck (element.rhs (), OTHER);
1971+ convert_expr_to (element.rhs (), element.lhs ().type ());
19741972 return ;
19751973
19761974 case smv_parse_treet::modulet::elementt::ASSIGN_INIT:
1977- typecheck (element.equal_expr ().lhs (), INIT);
1978- typecheck (element.equal_expr ().rhs (), INIT);
1979- convert_expr_to (
1980- element.equal_expr ().rhs (), element.equal_expr ().lhs ().type ());
1981- element.equal_expr ().type () = bool_typet{};
1982- no_next_allowed (element.equal_expr ().rhs ());
1975+ typecheck (element.lhs (), INIT);
1976+ typecheck (element.rhs (), INIT);
1977+ convert_expr_to (element.rhs (), element.lhs ().type ());
1978+ no_next_allowed (element.rhs ());
19831979 return ;
19841980
19851981 case smv_parse_treet::modulet::elementt::ASSIGN_NEXT:
1986- typecheck (element.equal_expr ().lhs (), TRANS);
1987- typecheck (element.equal_expr ().rhs (), TRANS);
1988- convert_expr_to (
1989- element.equal_expr ().rhs (), element.equal_expr ().lhs ().type ());
1990- element.equal_expr ().type () = bool_typet{};
1982+ typecheck (element.lhs (), TRANS);
1983+ typecheck (element.rhs (), TRANS);
1984+ convert_expr_to (element.rhs (), element.lhs ().type ());
19911985 return ;
19921986
19931987 case smv_parse_treet::modulet::elementt::DEFINE:
19941988 typecheck (element.expr , OTHER);
1995- element.equal_expr ().type () = bool_typet{};
19961989 return ;
19971990
19981991 case smv_parse_treet::modulet::elementt::ENUM:
@@ -2077,8 +2070,7 @@ void smv_typecheckt::variable_checks(const smv_parse_treet::modulet &module)
20772070 }
20782071 else if (element.is_define ())
20792072 {
2080- const auto &identifier_expr =
2081- to_smv_identifier_expr (to_equal_expr (element.expr ).lhs ());
2073+ const auto &identifier_expr = to_smv_identifier_expr (element.lhs ());
20822074 irep_idt base_name = identifier_expr.identifier ();
20832075
20842076 // already used as enum?
@@ -2202,8 +2194,7 @@ void smv_typecheckt::create_var_symbols(
22022194 }
22032195 else if (element.is_define ())
22042196 {
2205- const auto &identifier_expr =
2206- to_smv_identifier_expr (to_equal_expr (element.expr ).lhs ());
2197+ const auto &identifier_expr = to_smv_identifier_expr (element.lhs ());
22072198 irep_idt base_name = identifier_expr.identifier ();
22082199 irep_idt identifier = module + " ::var::" + id2string (base_name);
22092200
@@ -2264,11 +2255,8 @@ Function: smv_typecheckt::collect_define
22642255
22652256\*******************************************************************/
22662257
2267- void smv_typecheckt::collect_define (const equal_exprt &expr )
2258+ void smv_typecheckt::collect_define (const exprt &lhs, const exprt &rhs )
22682259{
2269- const exprt &lhs = expr.lhs ();
2270- const exprt &rhs = expr.rhs ();
2271-
22722260 if (lhs.id () != ID_symbol)
22732261 throw errort () << " collect_define expects symbol on left hand side" ;
22742262
@@ -2294,9 +2282,9 @@ void smv_typecheckt::collect_define(const equal_exprt &expr)
22942282
22952283 if (!result.second )
22962284 {
2297- throw errort ().with_location (expr. find_source_location ())
2285+ throw errort ().with_location (lhs. source_location ())
22982286 << " variable `" << symbol.display_name () << " ' already defined" ;
2299- }
2287+ }
23002288}
23012289
23022290/* ******************************************************************\
@@ -2475,7 +2463,7 @@ void smv_typecheckt::convert(smv_parse_treet::modulet &smv_module)
24752463 for (auto &element : smv_module.elements )
24762464 {
24772465 if (element.is_define () || element.is_assign_current ())
2478- collect_define (element.equal_expr ());
2466+ collect_define (element.lhs (), element. rhs ());
24792467 }
24802468 // now turn them into INVARs
24812469 convert_defines (trans_invar);
0 commit comments