IdeDebugger: fix searching array-index in expression.

(cherry picked from commit f581d4f764)
This commit is contained in:
Martin 2024-07-07 18:11:26 +02:00
parent 2c6dbb037a
commit 57f4185083
2 changed files with 7 additions and 6 deletions

View File

@ -324,6 +324,11 @@ begin
if p^ in ['@', '.', '+', '-', '*', '/', '(', ',', '=', '<', '>', '#', '$', '%', '&', '!'] then begin
MaybeBeforeArrayIdx := False; // after operator. A [1..5] would be a set of byte
if (p^ = '(') and (InArrayIdxBracket > 0) then begin
inc(InRndBracket);
MaybeBeforeArrayIdx := False;
end
else
if (InArrayIdxBracket > 0) and (InSqrBracket = 0) and (InRndBracket = 0) then begin
if (p^ = '.') and (p[1] = '.') then begin
if FoundDotDot then
@ -387,12 +392,6 @@ begin
end
else
if (p^ = '(') and (InArrayIdxBracket > 0) then begin
inc(InRndBracket);
MaybeBeforeArrayIdx := False;
end
else
if (p^ = '[') then begin
if (not MaybeBeforeArrayIdx) then begin

View File

@ -74,6 +74,8 @@ begin
Test('e1 in [x[1..15]]', 11, 'e1 in [x[11]]');
Test('e1 in [x[1..15]..x[33..35]]', 11, 'e1 in [x[11]..x[33..35]]');
Test('PFoo((TList(FData).FList)^[0..TList(FData).FCount-1].FObject)^', 11, 'PFoo((TList(FData).FList)^[11].FObject)^');
Test('PFoo((TList(FData).FList)^[-1..TList(FData).FCount-1].FObject)^', 11, 'PFoo((TList(FData).FList)^[11].FObject)^');
end;
initialization