@@ -394,23 +394,22 @@ void code_contractst::replace_old_parameter(
394
394
395
395
const auto ¶meter = to_old_expr (expr).expression ();
396
396
397
- // TODO: generalize below
398
- if (parameter.id () == ID_dereference)
397
+ if (
398
+ parameter.id () == ID_dereference || parameter.id () == ID_member ||
399
+ parameter.id () == ID_symbol)
399
400
{
400
- const auto &dereference_expr = to_dereference_expr (parameter);
401
-
402
- auto it = parameter2history.find (dereference_expr);
401
+ auto it = parameter2history.find (parameter);
403
402
404
403
if (it == parameter2history.end ())
405
404
{
406
405
// 1. Create a temporary symbol expression that represents the
407
406
// history variable
408
407
symbol_exprt tmp_symbol =
409
- new_tmp_symbol (dereference_expr .type (), location, mode).symbol_expr ();
408
+ new_tmp_symbol (parameter .type (), location, mode).symbol_expr ();
410
409
411
410
// 2. Associate the above temporary variable to it's corresponding
412
411
// expression
413
- parameter2history[dereference_expr ] = tmp_symbol;
412
+ parameter2history[parameter ] = tmp_symbol;
414
413
415
414
// 3. Add the required instructions to the instructions list
416
415
// 3.1 Declare the newly created temporary variable
@@ -419,11 +418,11 @@ void code_contractst::replace_old_parameter(
419
418
// 3.2 Add an assignment such that the value pointed to by the new
420
419
// temporary variable is equal to the value of the corresponding
421
420
// parameter
422
- history.add (goto_programt::make_assignment (
423
- tmp_symbol, dereference_expr , location));
421
+ history.add (
422
+ goto_programt::make_assignment ( tmp_symbol, parameter , location));
424
423
}
425
424
426
- expr = parameter2history[dereference_expr ];
425
+ expr = parameter2history[parameter ];
427
426
}
428
427
else
429
428
{
0 commit comments