Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/smvlang/smv_typecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,20 @@ void smv_typecheckt::instantiate(
parameter_map.emplace(parameters[i], arguments[i]);
}

const std::string prefix = id2string(instance) + '.';
// We add a prefix to all identifiers in the instantiated
// module -- this prefix is called "context" in Sec. 2.3.16 in
// the NuSMV 2.7 manual.
const std::string context = id2string(instance) + '.';

// copy the parse tree elements
for(auto &src_element : instantiated_module.elements)
{
auto copy = src_element;

// replace the parameter identifiers,
// and add the prefix to non-parameter, non-enum identifiers
// and add the context prefix to non-parameter, non-enum identifiers
copy.expr.visit_post(
[&parameter_map, &prefix, this](exprt &expr)
[&parameter_map, &context, this](exprt &expr)
{
if(expr.id() == ID_smv_identifier)
{
Expand All @@ -298,9 +301,9 @@ void smv_typecheckt::instantiate(
}
else
{
// add the prefix
// add the context prefix
to_smv_identifier_expr(expr).identifier(
prefix + id2string(identifier));
context + id2string(identifier));
}
}
});
Expand Down
Loading