@@ -40,36 +40,31 @@ bvt boolbvt::convert_let(const let_exprt &expr)
4040 for (auto &value : values)
4141 converted_values.push_back (convert_bv (value));
4242
43- scope_counter++;
44-
45- // for renaming the bound symbols
46- replace_symbolt replace_symbol;
43+ // get fresh bound symbols
44+ auto fresh_variables = fresh_binding (expr.binding ());
4745
4846 // Now assign
49- for (const auto &binding : make_range (variables ).zip (converted_values))
47+ for (const auto &binding : make_range (fresh_variables ).zip (converted_values))
5048 {
5149 bool is_boolean = binding.first .type ().id () == ID_bool;
52- const auto &old_identifier = binding.first .get_identifier ();
53-
54- // produce a new identifier
55- const irep_idt new_identifier =
56- " boolbvt::scope::" + std::to_string (scope_counter) +
57- " ::" + id2string (old_identifier);
50+ const auto &identifier = binding.first .get_identifier ();
5851
5952 // make the symbol visible
6053 if (is_boolean)
6154 {
6255 DATA_INVARIANT (binding.second .size () == 1 , " boolean values have one bit" );
63- symbols[new_identifier ] = binding.second [0 ];
56+ symbols[identifier ] = binding.second [0 ];
6457 }
6558 else
66- map.set_literals (new_identifier, binding.first .type (), binding.second );
67-
68- // remember the renaming
69- replace_symbol.insert (
70- binding.first , symbol_exprt (new_identifier, binding.first .type ()));
59+ map.set_literals (identifier, binding.first .type (), binding.second );
7160 }
7261
62+ // for renaming the bound symbols
63+ replace_symbolt replace_symbol;
64+
65+ for (const auto &pair : make_range (variables).zip (fresh_variables))
66+ replace_symbol.insert (pair.first , pair.second );
67+
7368 // rename the bound symbols in 'where'
7469 exprt where_renamed = expr.where ();
7570 replace_symbol (where_renamed);
@@ -78,14 +73,13 @@ bvt boolbvt::convert_let(const let_exprt &expr)
7873 bvt result_bv = convert_bv (where_renamed);
7974
8075 // the mapping can now be deleted
81- for (const auto &entry : replace_symbol. get_expr_map () )
76+ for (const auto &entry : fresh_variables )
8277 {
83- const auto &new_symbol = to_symbol_expr (entry.second );
84- const auto &type = new_symbol.type ();
78+ const auto &type = entry.type ();
8579 if (type.id () == ID_bool)
86- symbols.erase (new_symbol .get_identifier ());
80+ symbols.erase (entry .get_identifier ());
8781 else
88- map.erase_literals (new_symbol .get_identifier (), type);
82+ map.erase_literals (entry .get_identifier (), type);
8983 }
9084
9185 return result_bv;
0 commit comments