codetools: fixed parsing classes containing only the inheritage brackets, but no end (bug #10563)

git-svn-id: trunk@13644 -
This commit is contained in:
mattias 2008-01-05 23:04:14 +00:00
parent ebeaadf940
commit f9cbb95fc4

View File

@ -3146,6 +3146,7 @@ var
ClassAtomPos: TAtomPosition; ClassAtomPos: TAtomPosition;
Level: integer; Level: integer;
ContextDesc: Word; ContextDesc: Word;
IsForward: Boolean;
begin begin
ContextDesc:=CurNode.Desc; ContextDesc:=CurNode.Desc;
if not (ContextDesc in [ctnTypeDefinition,ctnGenericType, if not (ContextDesc in [ctnTypeDefinition,ctnGenericType,
@ -3167,8 +3168,10 @@ begin
CurNode.StartPos:=ClassAtomPos.StartPos; CurNode.StartPos:=ClassAtomPos.StartPos;
end; end;
// find end of class // find end of class
IsForward:=true;
ReadNextAtom; ReadNextAtom;
if UpAtomIs('OF') then begin if UpAtomIs('OF') then begin
IsForward:=false;
if ChildCreated then CurNode.Desc:=ctnClassOfType; if ChildCreated then CurNode.Desc:=ctnClassOfType;
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifier(true);
@ -3186,11 +3189,12 @@ begin
SaveRaiseExceptionFmt(ctsAnonymDefinitionsAreNotAllowed,['class']); SaveRaiseExceptionFmt(ctsAnonymDefinitionsAreNotAllowed,['class']);
end else if (CurPos.Flag=cafRoundBracketOpen) then begin end else if (CurPos.Flag=cafRoundBracketOpen) then begin
// read inheritage brackets // read inheritage brackets
IsForward:=false;
ReadTilBracketClose(true); ReadTilBracketClose(true);
ReadNextAtom; ReadNextAtom;
end; end;
if CurPos.Flag=cafSemicolon then begin 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 // forward class definition found
CurNode.SubDesc:=CurNode.SubDesc+ctnsForwardDeclaration; CurNode.SubDesc:=CurNode.SubDesc+ctnsForwardDeclaration;
end; end;
@ -3250,8 +3254,9 @@ begin
ReadTilBracketClose(true); ReadTilBracketClose(true);
ReadNextAtom; ReadNextAtom;
end; end;
if CurPos.Flag=cafEdgedBracketOpen then if CurPos.Flag=cafEdgedBracketOpen then begin
ReadGUID; ReadGUID;
end;
// parse till "end" of class/object // parse till "end" of class/object
CurKeyWordFuncList:=ClassInterfaceKeyWordFuncList; CurKeyWordFuncList:=ClassInterfaceKeyWordFuncList;
try try