From f9cbb95fc4ee6d87f5340c5b5285bdb8be214d4f Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 5 Jan 2008 23:04:14 +0000 Subject: [PATCH] codetools: fixed parsing classes containing only the inheritage brackets, but no end (bug #10563) git-svn-id: trunk@13644 - --- components/codetools/pascalparsertool.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index 049a172b11..af40e7f63f 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -3146,6 +3146,7 @@ var ClassAtomPos: TAtomPosition; Level: integer; ContextDesc: Word; + IsForward: Boolean; begin ContextDesc:=CurNode.Desc; if not (ContextDesc in [ctnTypeDefinition,ctnGenericType, @@ -3167,8 +3168,10 @@ begin CurNode.StartPos:=ClassAtomPos.StartPos; end; // find end of class + IsForward:=true; ReadNextAtom; if UpAtomIs('OF') then begin + IsForward:=false; if ChildCreated then CurNode.Desc:=ctnClassOfType; ReadNextAtom; AtomIsIdentifier(true); @@ -3186,11 +3189,12 @@ begin SaveRaiseExceptionFmt(ctsAnonymDefinitionsAreNotAllowed,['class']); end else if (CurPos.Flag=cafRoundBracketOpen) then begin // read inheritage brackets + IsForward:=false; ReadTilBracketClose(true); ReadNextAtom; end; if CurPos.Flag=cafSemicolon then begin - if ChildCreated and (CurNode.Desc=ctnClass) then begin + if ChildCreated and (CurNode.Desc=ctnClass) and IsForward then begin // forward class definition found CurNode.SubDesc:=CurNode.SubDesc+ctnsForwardDeclaration; end; @@ -3250,8 +3254,9 @@ begin ReadTilBracketClose(true); ReadNextAtom; end; - if CurPos.Flag=cafEdgedBracketOpen then + if CurPos.Flag=cafEdgedBracketOpen then begin ReadGUID; + end; // parse till "end" of class/object CurKeyWordFuncList:=ClassInterfaceKeyWordFuncList; try