mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 23:39:18 +02:00
codetools: fixed adding published method into implicit first published section
git-svn-id: trunk@22941 -
This commit is contained in:
parent
5cdcfd3451
commit
2f778c1f3b
@ -268,12 +268,12 @@ type
|
|||||||
out Graph: TCodeGraph; OnlyInterface: boolean): boolean;
|
out Graph: TCodeGraph; OnlyInterface: boolean): boolean;
|
||||||
procedure WriteCodeGraphDebugReport(Graph: TCodeGraph);
|
procedure WriteCodeGraphDebugReport(Graph: TCodeGraph);
|
||||||
function FindEmptyMethods(CursorPos: TCodeXYPosition;
|
function FindEmptyMethods(CursorPos: TCodeXYPosition;
|
||||||
const AClassName: string;
|
const AClassName: string; // can be ''
|
||||||
const Sections: TPascalClassSections;
|
const Sections: TPascalClassSections;
|
||||||
ListOfPCodeXYPosition: TFPList;
|
ListOfPCodeXYPosition: TFPList;
|
||||||
out AllEmpty: boolean): boolean;
|
out AllEmpty: boolean): boolean;
|
||||||
function FindEmptyMethods(CursorPos: TCodeXYPosition;
|
function FindEmptyMethods(CursorPos: TCodeXYPosition;
|
||||||
const AClassName: string;
|
const AClassName: string; // can be ''
|
||||||
const Sections: TPascalClassSections;
|
const Sections: TPascalClassSections;
|
||||||
CodeTreeNodeExtensions: TAVLTree;
|
CodeTreeNodeExtensions: TAVLTree;
|
||||||
out AllEmpty: boolean): boolean;
|
out AllEmpty: boolean): boolean;
|
||||||
@ -5727,7 +5727,7 @@ begin
|
|||||||
ANode:=ANode.NextBrother;
|
ANode:=ANode.NextBrother;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// find a nice position between similar siblings
|
// find a nice position between similar siblings
|
||||||
case ASourceChangeCache.BeautifyCodeOptions.ClassPartInsertPolicy of
|
case ASourceChangeCache.BeautifyCodeOptions.ClassPartInsertPolicy of
|
||||||
|
|
||||||
@ -5789,7 +5789,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if InsertNode<>nil then begin
|
if InsertNode<>nil then begin
|
||||||
|
|
||||||
// for variable lists: a,b,c: integer
|
// for variable lists: a,b,c: integer
|
||||||
@ -5826,7 +5826,14 @@ begin
|
|||||||
Indent:=GetLineIndent(Src,ClassSectionNode.StartPos)
|
Indent:=GetLineIndent(Src,ClassSectionNode.StartPos)
|
||||||
+ASourceChangeCache.BeautifyCodeOptions.Indent;
|
+ASourceChangeCache.BeautifyCodeOptions.Indent;
|
||||||
InsertPos:=ClassSectionNode.StartPos;
|
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
|
then begin
|
||||||
// skip keyword
|
// skip keyword
|
||||||
MoveCursorToCleanPos(InsertPos);
|
MoveCursorToCleanPos(InsertPos);
|
||||||
|
@ -370,9 +370,9 @@ type
|
|||||||
|
|
||||||
// method jumping
|
// method jumping
|
||||||
function JumpToMethod(Code: TCodeBuffer; X,Y: integer;
|
function JumpToMethod(Code: TCodeBuffer; X,Y: integer;
|
||||||
var NewCode: TCodeBuffer;
|
out NewCode: TCodeBuffer;
|
||||||
var NewX, NewY, NewTopLine: integer;
|
out NewX, NewY, NewTopLine: integer;
|
||||||
var RevertableJump: boolean): boolean;
|
out RevertableJump: boolean): boolean;
|
||||||
|
|
||||||
// find declaration
|
// find declaration
|
||||||
function FindDeclaration(Code: TCodeBuffer; X,Y: integer;
|
function FindDeclaration(Code: TCodeBuffer; X,Y: integer;
|
||||||
@ -504,7 +504,8 @@ type
|
|||||||
function ReplaceAllTypeCastFunctions(Code: TCodeBuffer): boolean;
|
function ReplaceAllTypeCastFunctions(Code: TCodeBuffer): boolean;
|
||||||
function FixForwardDefinitions(Code: TCodeBuffer): boolean;
|
function FixForwardDefinitions(Code: TCodeBuffer): boolean;
|
||||||
function FindEmptyMethods(Code: TCodeBuffer;
|
function FindEmptyMethods(Code: TCodeBuffer;
|
||||||
const AClassName: string; X,Y: integer;
|
const AClassName: string; // can be ''
|
||||||
|
X,Y: integer;
|
||||||
const Sections: TPascalClassSections;
|
const Sections: TPascalClassSections;
|
||||||
ListOfPCodeXYPosition: TFPList;
|
ListOfPCodeXYPosition: TFPList;
|
||||||
out AllEmpty: boolean): boolean;
|
out AllEmpty: boolean): boolean;
|
||||||
@ -1696,8 +1697,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCodeToolManager.JumpToMethod(Code: TCodeBuffer; X,Y: integer;
|
function TCodeToolManager.JumpToMethod(Code: TCodeBuffer; X,Y: integer;
|
||||||
var NewCode: TCodeBuffer; var NewX, NewY, NewTopLine: integer;
|
out NewCode: TCodeBuffer; out NewX, NewY, NewTopLine: integer;
|
||||||
var RevertableJump: boolean): boolean;
|
out RevertableJump: boolean): boolean;
|
||||||
var
|
var
|
||||||
CursorPos: TCodeXYPosition;
|
CursorPos: TCodeXYPosition;
|
||||||
NewPos: TCodeXYPosition;
|
NewPos: TCodeXYPosition;
|
||||||
|
@ -62,7 +62,7 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
raise Exception.Create('Adding method failed');
|
raise Exception.Create('Adding method failed');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Example 2: adding methods directly, but several at a time
|
// Example 2: adding methods directly, but several at a time
|
||||||
AClassName:='TMyClass';
|
AClassName:='TMyClass';
|
||||||
if not CodeToolBoss.InitClassCompletion(Code,UpperCase(AClassName),Tool) then
|
if not CodeToolBoss.InitClassCompletion(Code,UpperCase(AClassName),Tool) then
|
||||||
|
Loading…
Reference in New Issue
Block a user