codetools: fixed code completion for semicolons after procs bugs #10741

git-svn-id: trunk@13937 -
This commit is contained in:
mattias 2008-01-31 13:53:10 +00:00
parent a740c37d9c
commit 59077ba016
2 changed files with 24 additions and 3 deletions

View File

@ -4955,9 +4955,18 @@ begin
ProcCode:=ExtractProcHead(ANode,[phpWithStart,
phpWithoutClassKeyword,
phpWithVarModifiers,phpWithParameterNames,phpWithResultType,
phpWithCallingSpecs,phpDoNotAddSemicolon]);
phpWithProcModifiers,phpDoNotAddSemicolon]);
if ProcCode[length(ProcCode)]<>';' then begin
// add missing semicolon
// add missing semicolon at end of procedure head
UndoReadNextAtom;
if not ASourceChangeCache.Replace(gtNone,gtNone,
CurPos.EndPos,CurPos.EndPos,';') then
RaiseException('InsertMissingClassSemicolons: unable to insert semicolon');
end;
MoveCursorToFirstProcSpecifier(ANode);
if (CurPos.Flag<>cafSemicolon) and (CurPos.EndPos<ANode.FirstChild.EndPos)
then begin
// add missing semicolon in front of proc modifiers
UndoReadNextAtom;
if not ASourceChangeCache.Replace(gtNone,gtNone,
CurPos.EndPos,CurPos.EndPos,';') then

View File

@ -423,6 +423,11 @@ begin
ExtractNextAtom(phpWithResultType in Attr,Attr);
if not AtomIsIdentifier(false) then exit;
ExtractNextAtom(phpWithResultType in Attr,Attr);
if CurPos.Flag=cafPoint then begin
ExtractNextAtom(phpWithResultType in Attr,Attr);
if not AtomIsIdentifier(false) then exit;
ExtractNextAtom(phpWithResultType in Attr,Attr);
end;
ExtractProcHeadPos:=phepResultType;
end;
// read 'of object'
@ -676,7 +681,14 @@ begin
if (CurPos.Flag=cafColon) then begin
// read function result type
ReadNextAtom;
if AtomIsIdentifier(false) then begin
ReadNextAtom;
if CurPos.Flag=cafPoint then begin
ReadNextAtom;
if AtomIsIdentifier(false) then
ReadNextAtom;
end;
end;
end;
// CurPos now stands on the first proc specifier or on a semicolon
end;