Changeset 137 for trunk/UTarget.pas


Ignore:
Timestamp:
Mar 5, 2022, 4:38:34 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Wrong index variable used in inc/dec merge optimization.
  • Fixed: Reload output if program is reset.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTarget.pas

    r136 r137  
    167167  SNone = 'None';
    168168  SNormal = 'Normal';
     169  SProgramIndexError = 'Old program index higher than new (old: %d, new: %d)';
     170  SFirstIndexHigherThanLastIndex = 'First index higher than last index';
     171  SFirstIndexOutOfRange = 'First index out of range';
     172  SLastIndexOutOfRange = 'Last index out of range';
    169173
    170174const
     
    319323
    320324procedure TDebugSteps.UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgramFrom,
    321     NewProgramTo: Integer; NewTarget: Integer = 0);
     325  NewProgramTo: Integer; NewTarget: Integer = 0);
    322326var
    323327  I: Integer;
     
    329333  if (First <> -1) and (Last <> -1) then begin
    330334    if First > Last then
    331       raise Exception.Create('First index higher than last index');
     335      raise Exception.Create(SFirstIndexHigherThanLastIndex);
    332336    if (First < 0) or (First >= Count) then
    333       raise Exception.Create('First index out of range');
     337      raise Exception.Create(SFirstIndexOutOfRange);
    334338    if (Last < 0) or (Last >= Count) then
    335       raise Exception.Create('Last index out of range');
     339      raise Exception.Create(SLastIndexOutOfRange);
    336340    for I := Last downto First + 1 do Delete(I);
    337341
     
    343347      Items[First].TargetPosition := NewTarget;
    344348    end else
    345       raise Exception.Create('Old program index higher than new');
     349      raise Exception.Create(Format(SProgramIndexError, [SProgramIndexError, NewProgramTo]));
    346350  end;
    347351end;
Note: See TracChangeset for help on using the changeset viewer.