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 @@ -198,14 +198,21 @@ exprt smt2_parsert::let_expression()
198
198
if (next_token () != smt2_tokenizert::CLOSE)
199
199
throw error (" expected ')' at end of bindings" );
200
200
201
- // save the renaming map
202
- renaming_mapt old_renaming_map=renaming_map;
201
+ id_mapt old_ids;
203
202
204
- // go forwards, add to id_map, renaming if need be
203
+ // go forwards, add to id_map, but first saving the old id, if any
205
204
for (auto &b : bindings)
206
205
{
207
- // get a fresh id for it
208
- b.first = add_fresh_id (b.first , b.second );
206
+ auto id_map_it = id_map.find (b.first ); // already there?
207
+ if (id_map_it == id_map.end ()) // not there yet
208
+ {
209
+ id_map.insert ({b.first , idt (b.second )});
210
+ }
211
+ else
212
+ {
213
+ old_ids.emplace (*id_map_it); // save old ID
214
+ id_map_it->second = idt (b.second ); // overwrite
215
+ }
209
216
}
210
217
211
218
exprt expr=expression ();
@@ -225,11 +232,9 @@ exprt smt2_parsert::let_expression()
225
232
result=let;
226
233
}
227
234
228
- // we keep these in the id_map in order to retain globally
229
- // unique identifiers
230
-
231
- // restore renamings
232
- renaming_map=old_renaming_map;
235
+ // restore identifiers
236
+ for (auto &old_id : old_ids)
237
+ id_map.at (old_id.first ) = std::move (old_id.second );
233
238
234
239
return result;
235
240
}
You can’t perform that action at this time.
0 commit comments