Skip to content

Commit 1f9d898

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 2be0696 commit 1f9d898

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

@@ -67,10 +68,9 @@ void smv_languaget::dependencies(
6768

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

70-
for(smv_parse_treet::mc_varst::const_iterator it=smv_module.vars.begin();
71-
it!=smv_module.vars.end(); it++)
72-
if(it->second.type.id()=="submodule")
73-
module_set.insert(it->second.type.get_string("identifier"));
71+
for(auto &item : smv_module.items)
72+
if(item.is_var() && item.expr.type().id() == "submodule")
73+
module_set.insert(item.expr.type().get_string("identifier"));
7474
}
7575

7676
/*******************************************************************\
@@ -143,29 +143,28 @@ void smv_languaget::show_parse(std::ostream &out, message_handlert &)
143143

144144
out << " VARIABLES:" << std::endl;
145145

146-
for(smv_parse_treet::mc_varst::const_iterator it=module.vars.begin();
147-
it!=module.vars.end(); it++)
148-
if(it->second.type.id()!="submodule")
146+
for(auto &item : module.items)
147+
if(item.is_var() && item.expr.type().id() != "submodule")
149148
{
150149
symbol_tablet symbol_table;
151150
namespacet ns{symbol_table};
152-
auto msg = type2smv(it->second.type, ns);
153-
out << " " << it->first << ": " << msg << ";\n";
151+
auto identifier = to_smv_identifier_expr(item.expr).identifier();
152+
auto msg = type2smv(item.expr.type(), ns);
153+
out << " " << identifier << ": " << msg << ";\n";
154154
}
155155

156156
out << std::endl;
157157

158158
out << " SUBMODULES:" << std::endl;
159159

160-
for(smv_parse_treet::mc_varst::const_iterator
161-
it=module.vars.begin();
162-
it!=module.vars.end(); it++)
163-
if(it->second.type.id()=="submodule")
160+
for(auto &item : module.items)
161+
if(item.is_var() && item.expr.type().id() == "submodule")
164162
{
165163
symbol_tablet symbol_table;
166164
namespacet ns(symbol_table);
167-
auto msg = type2smv(it->second.type, ns);
168-
out << " " << it->first << ": " << msg << ";\n";
165+
auto identifier = to_smv_identifier_expr(item.expr).identifier();
166+
auto msg = type2smv(item.expr.type(), ns);
167+
out << " " << identifier << ": " << msg << ";\n";
169168
}
170169

171170
out << std::endl;

0 commit comments

Comments
 (0)