From c6d56cf204a7431b19b2247a3f4cb0cefbb35b27 Mon Sep 17 00:00:00 2001 From: ondrej Date: Sat, 23 Jan 2016 18:15:41 +0000 Subject: [PATCH] codetools: raise assignment exception instead of the first one. Issue #29448 git-svn-id: trunk@51391 - --- components/codetools/codecompletiontool.pas | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index fdeb5d530f..0b71d9114d 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -9337,8 +9337,7 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition; RaiseExceptionInstance(TempE); end; - function TryAssignment(CleanCursorPos: Integer; CursorNode: TCodeTreeNode; - var LastCodeToolsError: ECodeToolError; LastCodeToolsErrorCleanPos: Integer): Boolean; + function TryAssignment(CleanCursorPos: Integer; CursorNode: TCodeTreeNode): Boolean; begin // Search only within the current instruction - stop on semicolon or else // (else isn't prepended by a semicolon in contrast to other keywords). @@ -9353,15 +9352,8 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition; begin // OK FOUND! ReadPriorAtom; - try - if TryComplete(CursorNode, CurPos.StartPos) then - exit(true); - except - if LastCodeToolsError<>nil then - ClearAndRaise(LastCodeToolsError, LastCodeToolsErrorCleanPos) // in case of error, raise the last one - else - raise; - end; + if TryComplete(CursorNode, CurPos.StartPos) then + exit(true); break; end; cafWord: @@ -9435,7 +9427,7 @@ begin end; // find first assignment before current. - if TryAssignment(CleanCursorPos, CursorNode, LastCodeToolsError, LastCodeToolsErrorCleanPos) then + if TryAssignment(CleanCursorPos, CursorNode) then Exit(true); if LastCodeToolsError<>nil then // no assignment found, reraise