From 4483337f544ad680c5599612a3b57f97cbce5db0 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 31 Oct 2009 17:19:00 +0000 Subject: [PATCH] codetools: FindStartOfTerm: check next atom git-svn-id: trunk@22361 - --- components/codetools/finddeclarationtool.pas | 22 +++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index a253759164..df1a9a85c4 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -5914,7 +5914,8 @@ function TFindDeclarationTool.FindStartOfTerm(EndPos: integer; InType: boolean 7. (A). 8. (A as B) 9. (@A) - 10. nothing (e.g. cursor behind semicolon, keyword or closing bracket) + 10. A()[] + 11. nothing (e.g. cursor behind semicolon, keyword or closing bracket) } procedure RaiseIdentNotFound; begin @@ -5923,17 +5924,28 @@ function TFindDeclarationTool.FindStartOfTerm(EndPos: integer; InType: boolean var CurAtom, NextAtom: TAtomPosition; NextAtomType, CurAtomType: TVariableAtomType; + StartPos: LongInt; begin - MoveCursorToCleanPos(FindStartOfAtom(Src,EndPos)); + StartPos:=FindStartOfAtom(Src,EndPos); + MoveCursorToCleanPos(StartPos); NextAtom:=CurPos; - NextAtomType:=vatSpace; + ReadNextAtom; + NextAtomType:=GetCurrentAtomType; repeat ReadPriorAtom; CurAtom:=CurPos; CurAtomType:=GetCurrentAtomType; if CurAtomType in [vatRoundBracketClose,vatEdgedBracketClose] then begin - ReadBackTilBracketOpen(true); - CurAtom.StartPos:=CurPos.StartPos; + if NextAtomType in [vatRoundBracketOpen,vatRoundBracketClose, + vatEdgedBracketOpen,vatEdgedBracketClose,vatPoint,vatUp, + vatAS,vatNone,vatSpace] + then begin + ReadBackTilBracketOpen(true); + CurAtom.StartPos:=CurPos.StartPos; + end else begin + Result:=NextAtom.StartPos; + exit; + end; end; // check if CurAtom belongs to variable if CurAtomType=vatINHERITED then begin