mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-07 16:52:40 +02:00
codetools: raise assignment exception instead of the first one. Issue #29448
git-svn-id: trunk@51391 -
This commit is contained in:
parent
d6f267a40d
commit
c6d56cf204
@ -9337,8 +9337,7 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
|
|||||||
RaiseExceptionInstance(TempE);
|
RaiseExceptionInstance(TempE);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TryAssignment(CleanCursorPos: Integer; CursorNode: TCodeTreeNode;
|
function TryAssignment(CleanCursorPos: Integer; CursorNode: TCodeTreeNode): Boolean;
|
||||||
var LastCodeToolsError: ECodeToolError; LastCodeToolsErrorCleanPos: Integer): Boolean;
|
|
||||||
begin
|
begin
|
||||||
// Search only within the current instruction - stop on semicolon or else
|
// Search only within the current instruction - stop on semicolon or else
|
||||||
// (else isn't prepended by a semicolon in contrast to other keywords).
|
// (else isn't prepended by a semicolon in contrast to other keywords).
|
||||||
@ -9353,15 +9352,8 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
|
|||||||
begin
|
begin
|
||||||
// OK FOUND!
|
// OK FOUND!
|
||||||
ReadPriorAtom;
|
ReadPriorAtom;
|
||||||
try
|
|
||||||
if TryComplete(CursorNode, CurPos.StartPos) then
|
if TryComplete(CursorNode, CurPos.StartPos) then
|
||||||
exit(true);
|
exit(true);
|
||||||
except
|
|
||||||
if LastCodeToolsError<>nil then
|
|
||||||
ClearAndRaise(LastCodeToolsError, LastCodeToolsErrorCleanPos) // in case of error, raise the last one
|
|
||||||
else
|
|
||||||
raise;
|
|
||||||
end;
|
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
cafWord:
|
cafWord:
|
||||||
@ -9435,7 +9427,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// find first assignment before current.
|
// find first assignment before current.
|
||||||
if TryAssignment(CleanCursorPos, CursorNode, LastCodeToolsError, LastCodeToolsErrorCleanPos) then
|
if TryAssignment(CleanCursorPos, CursorNode) then
|
||||||
Exit(true);
|
Exit(true);
|
||||||
|
|
||||||
if LastCodeToolsError<>nil then // no assignment found, reraise
|
if LastCodeToolsError<>nil then // no assignment found, reraise
|
||||||
|
Loading…
Reference in New Issue
Block a user