Skip to content

Commit 2e19c8b

Browse files
committed
SMV: avoid vars member in SMV parse tree
This replaces the use of the vars member in the SMV parse tree by use of the items list.
1 parent 80349c4 commit 2e19c8b

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/smvlang/smv_language.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Author: Daniel Kroening, [email protected]
1212
#include <util/symbol_table.h>
1313

1414
#include "expr2smv.h"
15+
#include "smv_expr.h"
1516
#include "smv_parser.h"
1617
#include "smv_typecheck.h"
1718
#include "smv_types.h"
@@ -68,11 +69,10 @@ void smv_languaget::dependencies(
6869

6970
const smv_parse_treet::modulet &smv_module=m_it->second;
7071

71-
for(smv_parse_treet::mc_varst::const_iterator it=smv_module.vars.begin();
72-
it!=smv_module.vars.end(); it++)
73-
if(it->second.type.id() == ID_smv_submodule)
72+
for(auto &item : smv_module.items)
73+
if(item.is_var() && item.expr.type().id() == ID_smv_submodule)
7474
module_set.insert(
75-
id2string(to_smv_submodule_type(it->second.type).identifier()));
75+
id2string(to_smv_submodule_type(item.expr.type()).identifier()));
7676
}
7777

7878
/*******************************************************************\
@@ -145,29 +145,28 @@ void smv_languaget::show_parse(std::ostream &out, message_handlert &)
145145

146146
out << " VARIABLES:" << std::endl;
147147

148-
for(smv_parse_treet::mc_varst::const_iterator it=module.vars.begin();
149-
it!=module.vars.end(); it++)
150-
if(it->second.type.id() != ID_smv_submodule)
148+
for(auto &item : module.items)
149+
if(item.is_var() && item.expr.type().id() != ID_smv_submodule)
151150
{
152151
symbol_tablet symbol_table;
153152
namespacet ns{symbol_table};
154-
auto msg = type2smv(it->second.type, ns);
155-
out << " " << it->first << ": " << msg << ";\n";
153+
auto identifier = to_smv_identifier_expr(item.expr).identifier();
154+
auto msg = type2smv(item.expr.type(), ns);
155+
out << " " << identifier << ": " << msg << ";\n";
156156
}
157157

158158
out << std::endl;
159159

160160
out << " SUBMODULES:" << std::endl;
161161

162-
for(smv_parse_treet::mc_varst::const_iterator
163-
it=module.vars.begin();
164-
it!=module.vars.end(); it++)
165-
if(it->second.type.id() == ID_smv_submodule)
162+
for(auto &item : module.items)
163+
if(item.is_var() && item.expr.type().id() == ID_smv_submodule)
166164
{
167165
symbol_tablet symbol_table;
168166
namespacet ns(symbol_table);
169-
auto msg = type2smv(it->second.type, ns);
170-
out << " " << it->first << ": " << msg << ";\n";
167+
auto identifier = to_smv_identifier_expr(item.expr).identifier();
168+
auto msg = type2smv(item.expr.type(), ns);
169+
out << " " << identifier << ": " << msg << ";\n";
171170
}
172171

173172
out << std::endl;

0 commit comments

Comments
 (0)