mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 13:59:26 +02:00
codetools: AddLocalVariable: fixed reusing var section
git-svn-id: trunk@30923 -
This commit is contained in:
parent
e6b930f85f
commit
4ef2e5bc3e
@ -975,13 +975,13 @@ var
|
|||||||
OtherSectionNode: TCodeTreeNode;
|
OtherSectionNode: TCodeTreeNode;
|
||||||
HeaderNode: TCodeTreeNode;
|
HeaderNode: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
//DebugLn('TCodeCompletionCodeTool.AddLocalVariable START CleanCursorPos=',CleanPosToStr(CleanCursorPos),' CleanLevelPos=',CleanPosToStr(CleanLevelPos));
|
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
if CleanLevelPos<1 then CleanLevelPos:=CleanCursorPos;
|
||||||
|
//DebugLn('TCodeCompletionCodeTool.AddLocalVariable START CleanCursorPos=',CleanPosToStr(CleanCursorPos),' CleanLevelPos=',CleanPosToStr(CleanLevelPos));
|
||||||
if not CleanPosToCodePos(CleanCursorPos,OldCodePos) then begin
|
if not CleanPosToCodePos(CleanCursorPos,OldCodePos) then begin
|
||||||
RaiseException('TCodeCompletionCodeTool.AddLocalVariable Internal Error: '
|
RaiseException('TCodeCompletionCodeTool.AddLocalVariable Internal Error: '
|
||||||
+'CleanPosToCodePos');
|
+'CleanPosToCodePos');
|
||||||
end;
|
end;
|
||||||
if CleanLevelPos<1 then CleanLevelPos:=CleanCursorPos;
|
|
||||||
|
|
||||||
// find the level and find sections in front
|
// find the level and find sections in front
|
||||||
Node:=Tree.Root;
|
Node:=Tree.Root;
|
||||||
@ -1003,13 +1003,13 @@ begin
|
|||||||
or ((Node.EndPos=CleanLevelPos)
|
or ((Node.EndPos=CleanLevelPos)
|
||||||
and ((Node.NextBrother=nil) or (Node.NextBrother.StartPos>CleanLevelPos))))
|
and ((Node.NextBrother=nil) or (Node.NextBrother.StartPos>CleanLevelPos))))
|
||||||
then begin
|
then begin
|
||||||
VarSectionNode:=nil;
|
|
||||||
OtherSectionNode:=nil;
|
|
||||||
HeaderNode:=nil;
|
|
||||||
if Node.Desc in [ctnInterface,ctnImplementation,ctnProgram,ctnLibrary,
|
if Node.Desc in [ctnInterface,ctnImplementation,ctnProgram,ctnLibrary,
|
||||||
ctnPackage,ctnProcedure]
|
ctnPackage,ctnProcedure]
|
||||||
then begin
|
then begin
|
||||||
// this node can have a var section
|
// this node can have a var section
|
||||||
|
VarSectionNode:=nil;
|
||||||
|
OtherSectionNode:=nil;
|
||||||
|
HeaderNode:=nil;
|
||||||
ParentNode:=Node;
|
ParentNode:=Node;
|
||||||
end else if Node.Desc=ctnUnit then begin
|
end else if Node.Desc=ctnUnit then begin
|
||||||
// the grand children can have a var section
|
// the grand children can have a var section
|
||||||
|
Loading…
Reference in New Issue
Block a user