codetools: fixed adding published method into implicit first published section

git-svn-id: trunk@22941 -
This commit is contained in:
mattias 2009-12-03 11:29:47 +00:00
parent 5cdcfd3451
commit 2f778c1f3b
3 changed files with 20 additions and 12 deletions

View File

@ -268,12 +268,12 @@ type
out Graph: TCodeGraph; OnlyInterface: boolean): boolean;
procedure WriteCodeGraphDebugReport(Graph: TCodeGraph);
function FindEmptyMethods(CursorPos: TCodeXYPosition;
const AClassName: string;
const AClassName: string; // can be ''
const Sections: TPascalClassSections;
ListOfPCodeXYPosition: TFPList;
out AllEmpty: boolean): boolean;
function FindEmptyMethods(CursorPos: TCodeXYPosition;
const AClassName: string;
const AClassName: string; // can be ''
const Sections: TPascalClassSections;
CodeTreeNodeExtensions: TAVLTree;
out AllEmpty: boolean): boolean;
@ -5826,7 +5826,14 @@ begin
Indent:=GetLineIndent(Src,ClassSectionNode.StartPos)
+ASourceChangeCache.BeautifyCodeOptions.Indent;
InsertPos:=ClassSectionNode.StartPos;
if (ClassSectionNode.Desc in (AllClassBaseSections+AllClassTypeSections))
if (ClassSectionNode.Desc=ctnClassPublished)
and (CompareIdentifiers(@Src[ClassSectionNode.StartPos],'published')<>0)
then begin
// the first published section has no keyword
if ClassSectionNode.NextBrother<>nil then
Indent:=GetLineIndent(Src,ClassSectionNode.StartPos)
+ASourceChangeCache.BeautifyCodeOptions.Indent;
end else if (ClassSectionNode.Desc in (AllClassBaseSections+AllClassTypeSections))
then begin
// skip keyword
MoveCursorToCleanPos(InsertPos);

View File

@ -370,9 +370,9 @@ type
// method jumping
function JumpToMethod(Code: TCodeBuffer; X,Y: integer;
var NewCode: TCodeBuffer;
var NewX, NewY, NewTopLine: integer;
var RevertableJump: boolean): boolean;
out NewCode: TCodeBuffer;
out NewX, NewY, NewTopLine: integer;
out RevertableJump: boolean): boolean;
// find declaration
function FindDeclaration(Code: TCodeBuffer; X,Y: integer;
@ -504,7 +504,8 @@ type
function ReplaceAllTypeCastFunctions(Code: TCodeBuffer): boolean;
function FixForwardDefinitions(Code: TCodeBuffer): boolean;
function FindEmptyMethods(Code: TCodeBuffer;
const AClassName: string; X,Y: integer;
const AClassName: string; // can be ''
X,Y: integer;
const Sections: TPascalClassSections;
ListOfPCodeXYPosition: TFPList;
out AllEmpty: boolean): boolean;
@ -1696,8 +1697,8 @@ begin
end;
function TCodeToolManager.JumpToMethod(Code: TCodeBuffer; X,Y: integer;
var NewCode: TCodeBuffer; var NewX, NewY, NewTopLine: integer;
var RevertableJump: boolean): boolean;
out NewCode: TCodeBuffer; out NewX, NewY, NewTopLine: integer;
out RevertableJump: boolean): boolean;
var
CursorPos: TCodeXYPosition;
NewPos: TCodeXYPosition;