File tree 1 file changed +15
-10
lines changed
1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -189,14 +189,21 @@ exprt smt2_parsert::let_expression()
189
189
if (next_token () != smt2_tokenizert::CLOSE)
190
190
throw error (" expected ')' at end of bindings" );
191
191
192
- // save the renaming map
193
- renaming_mapt old_renaming_map=renaming_map;
192
+ id_mapt old_ids;
194
193
195
- // go forwards, add to id_map, renaming if need be
194
+ // go forwards, add to id_map, but first saving the old id, if any
196
195
for (auto &b : bindings)
197
196
{
198
- // get a fresh id for it
199
- b.first = add_fresh_id (b.first , b.second );
197
+ auto id_map_it = id_map.find (b.first ); // already there?
198
+ if (id_map_it == id_map.end ()) // not there yet
199
+ {
200
+ id_map.insert ({b.first , idt (b.second )});
201
+ }
202
+ else
203
+ {
204
+ old_ids.emplace (*id_map_it); // save old ID
205
+ id_map_it->second = idt (b.second ); // overwrite
206
+ }
200
207
}
201
208
202
209
exprt expr=expression ();
@@ -216,11 +223,9 @@ exprt smt2_parsert::let_expression()
216
223
result=let;
217
224
}
218
225
219
- // we keep these in the id_map in order to retain globally
220
- // unique identifiers
221
-
222
- // restore renamings
223
- renaming_map=old_renaming_map;
226
+ // restore identifiers
227
+ for (auto &old_id : old_ids)
228
+ id_map.at (old_id.first ) = std::move (old_id.second );
224
229
225
230
return result;
226
231
}
You can’t perform that action at this time.
0 commit comments