codetools: fixed crash parsing operator with invalid name

git-svn-id: trunk@34879 -
This commit is contained in:
mattias 2012-01-22 22:44:23 +00:00
parent de7c2a8a60
commit 3e692990e1
3 changed files with 8 additions and 3 deletions

View File

@ -37,8 +37,8 @@ interface
{$I codetools.inc}
{ $DEFINE ShowIgnoreError}
{$DEFINE ShowDirtySrc}
{ $DEFINE VerboseUpdateNeeded}
{$DEFINE ShowDirtySrc}
uses
{$IFDEF MEM_CHECK}

View File

@ -553,7 +553,7 @@ begin
// scan code
BeginParsing(Range);
{$IFDEF VerboseUpdateNeeded}
DebugLn(['TPascalParserTool.BuildTree PARSING ... ScannedRange=',dbgs(Range),' new Range=',dbgs(Range),' ',MainFilename]);
DebugLn(['TPascalParserTool.BuildTree PARSING ... ScannedRange=',dbgs(ScannedRange),' new Range=',dbgs(Range),' ',MainFilename]);
{$ENDIF}
//debugln(['TPascalParserTool.BuildTree "',Src,'"']);

View File

@ -417,6 +417,7 @@ var
IsProcedure: Boolean;
IsFunction: Boolean;
IsOperator: Boolean;
EndPos: Integer;
const
SemiColon : char = ';';
begin
@ -545,7 +546,11 @@ begin
ExtractNextAtom(not (phpWithoutSemicolon in Attr),Attr);
// read specifiers
if [phpWithCallingSpecs,phpWithProcModifiers]*Attr<>[] then begin
while (CurPos.StartPos<ProcNode.FirstChild.EndPos) do begin
if ProcNode.FirstChild<>nil then
EndPos:=ProcNode.FirstChild.EndPos
else
EndPos:=SrcLen+1;
while (CurPos.StartPos<EndPos) do begin
if CurPos.Flag=cafSemicolon then begin
ExtractNextAtom(phpWithProcModifiers in Attr,Attr);
end else begin