@@ -394,23 +394,22 @@ void code_contractst::replace_old_parameter(
394394
395395 const auto ¶meter = to_old_expr (expr).expression ();
396396
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)
399400 {
400- const auto &dereference_expr = to_dereference_expr (parameter);
401-
402- auto it = parameter2history.find (dereference_expr);
401+ auto it = parameter2history.find (parameter);
403402
404403 if (it == parameter2history.end ())
405404 {
406405 // 1. Create a temporary symbol expression that represents the
407406 // history variable
408407 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 ();
410409
411410 // 2. Associate the above temporary variable to it's corresponding
412411 // expression
413- parameter2history[dereference_expr ] = tmp_symbol;
412+ parameter2history[parameter ] = tmp_symbol;
414413
415414 // 3. Add the required instructions to the instructions list
416415 // 3.1 Declare the newly created temporary variable
@@ -419,11 +418,11 @@ void code_contractst::replace_old_parameter(
419418 // 3.2 Add an assignment such that the value pointed to by the new
420419 // temporary variable is equal to the value of the corresponding
421420 // 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));
424423 }
425424
426- expr = parameter2history[dereference_expr ];
425+ expr = parameter2history[parameter ];
427426 }
428427 else
429428 {
0 commit comments