codetools: renamed TCodeTreeNodeExtension ExtTxt fields

This commit is contained in:
mattias 2025-01-26 13:46:44 +01:00
parent 680cab3fa0
commit 9d425ed90b
7 changed files with 120 additions and 115 deletions

View File

@ -178,7 +178,7 @@ type
procedure GuessProcDefBodyMapping(ProcDefNodes, ProcBodyNodes: TAVLTree; procedure GuessProcDefBodyMapping(ProcDefNodes, ProcBodyNodes: TAVLTree;
MapByNameOnly, MapLastOne: boolean); MapByNameOnly, MapLastOne: boolean);
function GatherClassProcDefinitions(ClassNode: TCodeTreeNode; function GatherClassProcDefinitions(ClassNode: TCodeTreeNode;
RemoveAbstracts: boolean): TAVLTree; RemoveAbstracts: boolean = false; RemoveExternals: boolean = false): TAVLTree;
function GatherClassProcBodies(ClassNode: TCodeTreeNode): TAVLTree; function GatherClassProcBodies(ClassNode: TCodeTreeNode): TAVLTree;
procedure CheckForOverrideAndAddInheritedCode( procedure CheckForOverrideAndAddInheritedCode(
ANodeExt: TCodeTreeNodeExtension; Indent: integer); ANodeExt: TCodeTreeNodeExtension; Indent: integer);
@ -509,7 +509,7 @@ begin
// search in new nodes, which will be inserted // search in new nodes, which will be inserted
ANodeExt:=FirstInsert; ANodeExt:=FirstInsert;
while ANodeExt<>nil do begin while ANodeExt<>nil do begin
if CompareTextIgnoringSpace(ANodeExt.Txt,NameAndParamsUpCase,true)=0 then if CompareTextIgnoringSpace(ANodeExt.Signature,NameAndParamsUpCase,true)=0 then
begin begin
Result.Tool:=Self; Result.Tool:=Self;
Result.Node:=CodeCompleteClassNode; Result.Node:=CodeCompleteClassNode;
@ -658,7 +658,7 @@ begin
// search in new nodes, which will be inserted // search in new nodes, which will be inserted
ANodeExt:=FirstInsert; ANodeExt:=FirstInsert;
while ANodeExt<>nil do begin while ANodeExt<>nil do begin
if CompareTextIgnoringSpace(ANodeExt.Txt,UpperName,true)=0 then if CompareTextIgnoringSpace(ANodeExt.Signature,UpperName,true)=0 then
exit(true); exit(true);
ANodeExt:=ANodeExt.Next; ANodeExt:=ANodeExt.Next;
end; end;
@ -721,10 +721,10 @@ begin
NewInsert:=TCodeTreeNodeExtension.Create; NewInsert:=TCodeTreeNodeExtension.Create;
with NewInsert do begin with NewInsert do begin
Node:=PosNode; Node:=PosNode;
Txt:=CleanDef; Signature:=CleanDef;
ExtTxt1:=Def; Code:=Def;
ExtTxt2:=IdentifierName; Identifier:=IdentifierName;
ExtTxt3:=Body; ProcBody:=Body;
Flags:=ord(TheType); Flags:=ord(TheType);
end; end;
if FirstInsert=nil then begin if FirstInsert=nil then begin
@ -743,9 +743,9 @@ begin
// insert alphabetically // insert alphabetically
InsertPos:=FirstInsert; InsertPos:=FirstInsert;
LastInsertPos:=nil; LastInsertPos:=nil;
//DebugLn('GGG "',InsertPos.Txt,'" "',CleanDef,'" ',CompareTextIgnoringSpace(InsertPos.Txt,CleanDef,false)); //DebugLn('GGG "',InsertPos.Signature,'" "',CleanDef,'" ',CompareTextIgnoringSpace(InsertPos.Signature,CleanDef,false));
while (InsertPos<>nil) while (InsertPos<>nil)
and (CompareTextIgnoringSpace(InsertPos.Txt,CleanDef,false)>=0) do begin and (CompareTextIgnoringSpace(InsertPos.Signature,CleanDef,false)>=0) do begin
LastInsertPos:=InsertPos; LastInsertPos:=InsertPos;
InsertPos:=InsertPos.Next; InsertPos:=InsertPos.Next;
end; end;
@ -760,7 +760,7 @@ begin
end; end;
{InsertPos:=FirstInsert; {InsertPos:=FirstInsert;
while InsertPos<>nil do begin while InsertPos<>nil do begin
DebugLn(' HHH ',InsertPos.Txt); DebugLn(' HHH ',InsertPos.Signature);
InsertPos:=InsertPos.Next; InsertPos:=InsertPos.Next;
end;} end;}
end; end;
@ -3434,7 +3434,7 @@ var
NodeExt:=TCodeTreeNodeExtension.Create; NodeExt:=TCodeTreeNodeExtension.Create;
NodeExt.Node:=Redefinition; NodeExt.Node:=Redefinition;
NodeExt.Data:=Definition; NodeExt.Data:=Definition;
NodeExt.Txt:=NodeText; NodeExt.Signature:=NodeText;
if TreeOfCodeTreeNodeExt=nil then if TreeOfCodeTreeNodeExt=nil then
TreeOfCodeTreeNodeExt:=TAVLTree.Create(@CompareCodeTreeNodeExt); TreeOfCodeTreeNodeExt:=TAVLTree.Create(@CompareCodeTreeNodeExt);
TreeOfCodeTreeNodeExt.Add(NodeExt); TreeOfCodeTreeNodeExt.Add(NodeExt);
@ -3446,7 +3446,7 @@ var
begin begin
NodeExt:=TCodeTreeNodeExtension.Create; NodeExt:=TCodeTreeNodeExtension.Create;
NodeExt.Node:=Node; NodeExt.Node:=Node;
NodeExt.Txt:=NodeText; NodeExt.Signature:=NodeText;
AllNodes.Add(NodeExt); AllNodes.Add(NodeExt);
end; end;
@ -3696,7 +3696,7 @@ var
TreeOfCodeTreeNodeExt:=TAVLTree.Create(@CompareCodeTreeNodeExt); TreeOfCodeTreeNodeExt:=TAVLTree.Create(@CompareCodeTreeNodeExt);
NodeExt:=TCodeTreeNodeExtension.Create; NodeExt:=TCodeTreeNodeExtension.Create;
NodeExt.Node:=Node; NodeExt.Node:=Node;
NodeExt.Txt:=GetRedefinitionNodeText(Node); NodeExt.Signature:=GetRedefinitionNodeText(Node);
NodeExt.Data:=ReferingNode; NodeExt.Data:=ReferingNode;
NodeExt.Flags:=NeededType; NodeExt.Flags:=NeededType;
TreeOfCodeTreeNodeExt.Add(NodeExt); TreeOfCodeTreeNodeExt.Add(NodeExt);
@ -3712,7 +3712,7 @@ var
// add new node // add new node
NodeExt:=TCodeTreeNodeExtension.Create; NodeExt:=TCodeTreeNodeExtension.Create;
NodeExt.Node:=Node; NodeExt.Node:=Node;
NodeExt.Txt:=NodeText; NodeExt.Signature:=NodeText;
AllNodes.Add(NodeExt); AllNodes.Add(NodeExt);
end else begin end else begin
// update node // update node
@ -4001,7 +4001,7 @@ begin
else if DefNode.Desc=ctnProcedure then else if DefNode.Desc=ctnProcedure then
ProcName:=ExtractProcName(DefNode,[]) ProcName:=ExtractProcName(DefNode,[])
else else
ProcName:=NodeExt.Txt; ProcName:=NodeExt.Signature;
NewSrc:=copy(NewSrc,1,FromPos-1)+ProcName NewSrc:=copy(NewSrc,1,FromPos-1)+ProcName
+copy(NewSrc,FromPos+length(OldProcName),length(NewSrc)); +copy(NewSrc,FromPos+length(OldProcName),length(NewSrc));
FromPos:=DefNode.StartPos; FromPos:=DefNode.StartPos;
@ -4195,10 +4195,10 @@ var
// save values // save values
ResultNodeExt:=TCodeTreeNodeExtension.Create; ResultNodeExt:=TCodeTreeNodeExtension.Create;
ResultNodeExt.Txt:=NodeText; ResultNodeExt.Signature:=NodeText;
ResultNodeExt.Node:=NodeExt.Node; ResultNodeExt.Node:=NodeExt.Node;
ResultNodeExt.Data:=ProcNode; ResultNodeExt.Data:=ProcNode;
ResultNodeExt.ExtTxt1:=ExtractCode(ExprStart,ExprEnd,[]); ResultNodeExt.Code:=ExtractCode(ExprStart,ExprEnd,[]);
if TreeOfCodeTreeNodeExt=nil then if TreeOfCodeTreeNodeExt=nil then
TreeOfCodeTreeNodeExt:=TAVLTree.Create(@CompareCodeTreeNodeExt); TreeOfCodeTreeNodeExt:=TAVLTree.Create(@CompareCodeTreeNodeExt);
TreeOfCodeTreeNodeExt.Add(ResultNodeExt); TreeOfCodeTreeNodeExt.Add(ResultNodeExt);
@ -4286,10 +4286,10 @@ begin
AVLNode:=TreeOfCodeTreeNodeExt.FindLowest; AVLNode:=TreeOfCodeTreeNodeExt.FindLowest;
while AVLNode<>nil do begin while AVLNode<>nil do begin
NodeExt:=TCodeTreeNodeExtension(AVLNode.Data); NodeExt:=TCodeTreeNodeExtension(AVLNode.Data);
DebugLn(['TCodeCompletionCodeTool.ReplaceConstFunctions ',NodeExt.Txt]); DebugLn(['TCodeCompletionCodeTool.ReplaceConstFunctions ',NodeExt.Signature]);
DefNode:=NodeExt.Node; DefNode:=NodeExt.Node;
BodyNode:=TCodeTreeNode(NodeExt.Data); BodyNode:=TCodeTreeNode(NodeExt.Data);
Expr:=NodeExt.ExtTxt1; Expr:=NodeExt.Code;
DebugLn(['TCodeCompletionCodeTool.ReplaceConstFunctions Expr=',Expr]); DebugLn(['TCodeCompletionCodeTool.ReplaceConstFunctions Expr=',Expr]);
// remove body node // remove body node
@ -4448,10 +4448,10 @@ var
// save values // save values
ResultNodeExt:=TCodeTreeNodeExtension.Create; ResultNodeExt:=TCodeTreeNodeExtension.Create;
ResultNodeExt.Txt:=NodeText; ResultNodeExt.Signature:=NodeText;
ResultNodeExt.Node:=NodeExt.Node; ResultNodeExt.Node:=NodeExt.Node;
ResultNodeExt.Data:=ProcNode; ResultNodeExt.Data:=ProcNode;
ResultNodeExt.ExtTxt1:=GetIdentifier(ResultType); ResultNodeExt.Code:=GetIdentifier(ResultType);
if TreeOfCodeTreeNodeExt=nil then if TreeOfCodeTreeNodeExt=nil then
TreeOfCodeTreeNodeExt:=TAVLTree.Create(@CompareCodeTreeNodeExt); TreeOfCodeTreeNodeExt:=TAVLTree.Create(@CompareCodeTreeNodeExt);
TreeOfCodeTreeNodeExt.Add(ResultNodeExt); TreeOfCodeTreeNodeExt.Add(ResultNodeExt);
@ -4537,10 +4537,10 @@ begin
AVLNode:=TreeOfCodeTreeNodeExt.FindLowest; AVLNode:=TreeOfCodeTreeNodeExt.FindLowest;
while AVLNode<>nil do begin while AVLNode<>nil do begin
NodeExt:=TCodeTreeNodeExtension(AVLNode.Data); NodeExt:=TCodeTreeNodeExtension(AVLNode.Data);
DebugLn(['TCodeCompletionCodeTool.ReplaceTypeCastFunctions ',NodeExt.Txt]); DebugLn(['TCodeCompletionCodeTool.ReplaceTypeCastFunctions ',NodeExt.Signature]);
DefNode:=NodeExt.Node; DefNode:=NodeExt.Node;
BodyNode:=TCodeTreeNode(NodeExt.Data); BodyNode:=TCodeTreeNode(NodeExt.Data);
Expr:=NodeExt.ExtTxt1; Expr:=NodeExt.Code;
DebugLn(['TCodeCompletionCodeTool.ReplaceTypeCastFunctions Expr=',Expr]); DebugLn(['TCodeCompletionCodeTool.ReplaceTypeCastFunctions Expr=',Expr]);
// remove body node // remove body node
@ -5531,7 +5531,7 @@ function TCodeCompletionCodeTool.GatherUnitDefinitions(out
RaiseRedefinition(NodeExt.Node,Node); RaiseRedefinition(NodeExt.Node,Node);
end; end;
NodeExt:=TCodeTreeNodeExtension.Create; NodeExt:=TCodeTreeNodeExtension.Create;
NodeExt.Txt:=NodeText; NodeExt.Signature:=NodeText;
TreeOfCodeTreeNodeExt.Add(NodeExt); TreeOfCodeTreeNodeExt.Add(NodeExt);
NodeExt.Node:=Node; NodeExt.Node:=Node;
end; end;
@ -5861,7 +5861,7 @@ begin
while AVLNode<>nil do begin while AVLNode<>nil do begin
NextAVLNode:=ProcBodyNodes.FindSuccessor(AVLNode); NextAVLNode:=ProcBodyNodes.FindSuccessor(AVLNode);
NodeExt:=TCodeTreeNodeExtension(AVLNode.Data); NodeExt:=TCodeTreeNodeExtension(AVLNode.Data);
//DebugLn(['TCodeCompletionCodeTool.FindEmptyMethods ',NodeExt.Txt,' ',ProcBodyIsEmpty(NodeExt.Node)]); //DebugLn(['TCodeCompletionCodeTool.FindEmptyMethods ',NodeExt.Signature,' ',ProcBodyIsEmpty(NodeExt.Node)]);
// check if proc body is empty (no code, no comments) // check if proc body is empty (no code, no comments)
if ProcBodyIsEmpty(NodeExt.Node) then begin if ProcBodyIsEmpty(NodeExt.Node) then begin
GatherClassProcs; GatherClassProcs;
@ -6075,9 +6075,9 @@ function TCodeCompletionCodeTool.FindAssignMethod(CursorPos: TCodeXYPosition;
NodeExt.Node:=Child; NodeExt.Node:=Child;
NodeExt.Position:=Child.StartPos; NodeExt.Position:=Child.StartPos;
if Child.Desc=ctnVarDefinition then if Child.Desc=ctnVarDefinition then
NodeExt.Txt:=ExtractDefinitionName(Child) NodeExt.Signature:=ExtractDefinitionName(Child)
else else
NodeExt.Txt:=ExtractPropName(Child,false); NodeExt.Signature:=ExtractPropName(Child,false);
MemberNodeExts.Add(NodeExt); MemberNodeExts.Add(NodeExt);
end; end;
@ -6296,7 +6296,7 @@ begin
for i:=0 to MemberNodeExts.Count-1 do begin for i:=0 to MemberNodeExts.Count-1 do begin
NodeExt:=TCodeTreeNodeExtension(MemberNodeExts[i]); NodeExt:=TCodeTreeNodeExtension(MemberNodeExts[i]);
// add assignment // add assignment
ProcBody:=ProcBody+Beauty.GetIndentStr(Indent)+NodeExt.Txt+':='+SrcVar+'.'+NodeExt.Txt+';'+e; ProcBody:=ProcBody+Beauty.GetIndentStr(Indent)+NodeExt.Signature+':='+SrcVar+'.'+NodeExt.Signature+';'+e;
end; end;
end; end;
@ -7815,7 +7815,7 @@ begin
if IsVariable then begin if IsVariable then begin
// the insertion is a new variable // the insertion is a new variable
if (ANode.Desc<>ctnVarDefinition) if (ANode.Desc<>ctnVarDefinition)
or (CompareNodeIdentChars(ANode,ANodeExt.Txt)<0) then or (CompareNodeIdentChars(ANode,ANodeExt.Signature)<0) then
break; break;
end else begin end else begin
// the insertion is a new method // the insertion is a new method
@ -7824,7 +7824,7 @@ begin
ctnProcedure: ctnProcedure:
begin begin
CurCode:=ExtractProcName(ANode,[]); CurCode:=ExtractProcName(ANode,[]);
if SysUtils.CompareText(CurCode,ANodeExt.ExtTxt2)>0 then if SysUtils.CompareText(CurCode,ANodeExt.Identifier)>0 then
break; break;
end; end;
@ -7834,7 +7834,7 @@ begin
.MixMethodsAndProperties then .MixMethodsAndProperties then
begin begin
CurCode:=ExtractPropName(ANode,false); CurCode:=ExtractPropName(ANode,false);
if SysUtils.CompareText(CurCode,ANodeExt.ExtTxt2)>0 then if SysUtils.CompareText(CurCode,ANodeExt.Identifier)>0 then
break; break;
end else end else
break; break;
@ -7939,7 +7939,7 @@ begin
//debugln(['TCodeCompletionCodeTool.InsertNewClassParts insert as first, InsertPos=',CleanPosToStr(InsertPos)]); //debugln(['TCodeCompletionCodeTool.InsertNewClassParts insert as first, InsertPos=',CleanPosToStr(InsertPos)]);
end; end;
end; end;
CurCode:=ANodeExt.ExtTxt1; CurCode:=ANodeExt.Code;
CurCode:=Beauty.BeautifyStatement(CurCode,Indent,[bcfChangeSymbolToBracketForGenericTypeBrackets]); CurCode:=Beauty.BeautifyStatement(CurCode,Indent,[bcfChangeSymbolToBracketForGenericTypeBrackets]);
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}
DebugLn('TCodeCompletionCodeTool.InsertNewClassParts:'); DebugLn('TCodeCompletionCodeTool.InsertNewClassParts:');
@ -8354,13 +8354,13 @@ begin
ANodeExt:=FirstInsert; ANodeExt:=FirstInsert;
while ANodeExt<>nil do begin while ANodeExt<>nil do begin
if not NodeExtIsVariable(ANodeExt) then begin if not NodeExtIsVariable(ANodeExt) then begin
if FindNodeExtInTree(ClassProcs,ANodeExt.Txt)=nil then begin if FindNodeExtInTree(ClassProcs,ANodeExt.Signature)=nil then begin
NewNodeExt:=TCodeTreeNodeExtension.Create; NewNodeExt:=TCodeTreeNodeExtension.Create;
with NewNodeExt do begin with NewNodeExt do begin
Txt:=UpperCaseStr(TheClassName)+'.'+ANodeExt.Txt; // Name+ParamTypeList Signature:=UpperCaseStr(TheClassName)+'.'+ANodeExt.Signature; // Name+ParamTypeList
ExtTxt1:=Beauty.AddClassAndNameToProc( Code:=Beauty.AddClassAndNameToProc(
ANodeExt.ExtTxt1,TheClassName,''); // complete proc head code ANodeExt.Code,TheClassName,''); // complete proc head code
ExtTxt3:=ANodeExt.ExtTxt3; ProcBody:=ANodeExt.ProcBody;
Position:=ANodeExt.Position; Position:=ANodeExt.Position;
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}
DebugLn(' Txt="',Txt,'"'); DebugLn(' Txt="',Txt,'"');
@ -8413,7 +8413,7 @@ begin
// update body signature in tree, // update body signature in tree,
// so that no new body is created for this definition // so that no new body is created for this definition
ProcBodyNodes.RemovePointer(BodyNodeExt); ProcBodyNodes.RemovePointer(BodyNodeExt);
BodyNodeExt.Txt:=DefNodeExt.Txt; BodyNodeExt.Signature:=DefNodeExt.Signature;
ProcBodyNodes.Add(BodyNodeExt); ProcBodyNodes.Add(BodyNodeExt);
end; end;
@ -8435,7 +8435,7 @@ begin
{$ENDIF} {$ENDIF}
Beauty:=FSourceChangeCache.BeautifyCodeOptions; Beauty:=FSourceChangeCache.BeautifyCodeOptions;
ProcNode:=ANodeExt.Node; ProcNode:=ANodeExt.Node;
if (ProcNode=nil) and (ANodeExt.ExtTxt3<>'') then Exit; if (ProcNode=nil) and (ANodeExt.ProcBody<>'') then Exit;
InclProcCall:=False; InclProcCall:=False;
if (ProcNodeHasSpecifier(ProcNode,psOVERRIDE)) then begin if (ProcNodeHasSpecifier(ProcNode,psOVERRIDE)) then begin
// Check for ancestor abstract method. // Check for ancestor abstract method.
@ -8477,7 +8477,7 @@ begin
ProcCode:=ProcCode+Beauty.LineEnd+'begin'+Beauty.LineEnd ProcCode:=ProcCode+Beauty.LineEnd+'begin'+Beauty.LineEnd
+Beauty.GetIndentStr(Beauty.Indent)+ProcCall+Beauty.LineEnd+'end;'; +Beauty.GetIndentStr(Beauty.Indent)+ProcCall+Beauty.LineEnd+'end;';
ProcCode:=Beauty.BeautifyProc(ProcCode,Indent,false); ProcCode:=Beauty.BeautifyProc(ProcCode,Indent,false);
ANodeExt.ExtTxt3:=ProcCode; ANodeExt.ProcBody:=ProcCode;
end; end;
end; end;
end; end;
@ -8585,7 +8585,7 @@ procedure TCodeCompletionCodeTool.GuessProcDefBodyMapping(ProcDefNodes,
ProcNode:=NodeExt.Node; ProcNode:=NodeExt.Node;
NewNodeExt:=TCodeTreeNodeExtension.Create; NewNodeExt:=TCodeTreeNodeExtension.Create;
NewNodeExt.Node:=ProcNode; NewNodeExt.Node:=ProcNode;
NewNodeExt.Txt:=ExtractProcName(ProcNode,[phpWithoutClassName]); NewNodeExt.Signature:=ExtractProcName(ProcNode,[phpWithoutClassName]);
NewNodeExt.Data:=NodeExt; NewNodeExt.Data:=NodeExt;
NewNodeExt.Flags:=Integer(ExtractProcedureGroup(ProcNode)); NewNodeExt.Flags:=Integer(ExtractProcedureGroup(ProcNode));
if Result=nil then if Result=nil then
@ -8729,8 +8729,8 @@ begin
MapLastBodyAndDef; // last: map if there is exactly one unmatching body and def MapLastBodyAndDef; // last: map if there is exactly one unmatching body and def
end; end;
function TCodeCompletionCodeTool.GatherClassProcDefinitions( function TCodeCompletionCodeTool.GatherClassProcDefinitions(ClassNode: TCodeTreeNode;
ClassNode: TCodeTreeNode; RemoveAbstracts: boolean): TAVLTree; RemoveAbstracts: boolean; RemoveExternals: boolean): TAVLTree;
var var
AnAVLNode: TAVLTreeNode; AnAVLNode: TAVLTreeNode;
NextAVLNode: TAVLTreeNode; NextAVLNode: TAVLTreeNode;
@ -8739,16 +8739,19 @@ var
begin begin
Result:=GatherProcNodes(ClassNode.FirstChild, Result:=GatherProcNodes(ClassNode.FirstChild,
[phpInUpperCase,phpAddClassName],ExtractClassName(ClassNode,true)); [phpInUpperCase,phpAddClassName],ExtractClassName(ClassNode,true));
if RemoveAbstracts then begin if RemoveAbstracts or RemoveExternals then begin
AnAVLNode:=Result.FindLowest; AnAVLNode:=Result.FindLowest;
while AnAVLNode<>nil do begin while AnAVLNode<>nil do begin
NextAVLNode:=Result.FindSuccessor(AnAVLNode); NextAVLNode:=Result.FindSuccessor(AnAVLNode);
ANodeExt:=TCodeTreeNodeExtension(AnAVLNode.Data); ANodeExt:=TCodeTreeNodeExtension(AnAVLNode.Data);
ANode:=ANodeExt.Node; ANode:=ANodeExt.Node;
if (ANode<>nil) and (ANode.Desc=ctnProcedure) if (ANode<>nil) and (ANode.Desc=ctnProcedure) then begin
and ProcNodeHasSpecifier(ANode,psABSTRACT) then begin if (RemoveAbstracts and ProcNodeHasSpecifier(ANode,psAbstract))
Result.Delete(AnAVLNode); or (RemoveExternals and ProcNodeHasSpecifier(ANode,psExternal)) then
ANodeExt.Free; begin
Result.Delete(AnAVLNode);
ANodeExt.Free;
end;
end; end;
AnAVLNode:=NextAVLNode; AnAVLNode:=NextAVLNode;
end; end;
@ -8773,21 +8776,21 @@ var
ProcCode: string; ProcCode: string;
begin begin
Beauty:=FSourceChangeCache.BeautifyCodeOptions; Beauty:=FSourceChangeCache.BeautifyCodeOptions;
if ANodeExt.ExtTxt3<>'' then if ANodeExt.ProcBody<>'' then
ProcCode:=ANodeExt.ExtTxt3 ProcCode:=ANodeExt.ProcBody
else else
ProcCode:=ANodeExt.ExtTxt1; ProcCode:=ANodeExt.Code;
ProcCode:=Beauty.AddClassAndNameToProc(ProcCode,TheClassName,''); ProcCode:=Beauty.AddClassAndNameToProc(ProcCode,TheClassName,'');
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}
DebugLn('CreateMethodBodies_Insert ',TheClassName,' "',ProcCode,'"'); DebugLn('CreateMethodBodies_Insert ',TheClassName,' "',ProcCode,'"');
{$ENDIF} {$ENDIF}
ProcCode:=Beauty.BeautifyProc(ProcCode,Indent,ANodeExt.ExtTxt3=''); ProcCode:=Beauty.BeautifyProc(ProcCode,Indent,ANodeExt.ProcBody='');
FSourceChangeCache.Replace(gtEmptyLine,gtEmptyLine,InsertPos,InsertPos,ProcCode); FSourceChangeCache.Replace(gtEmptyLine,gtEmptyLine,InsertPos,InsertPos,ProcCode);
if FJumpToProcHead.Name='' then begin if FJumpToProcHead.Name='' then begin
// remember one proc body to jump to after the completion // remember one proc body to jump to after the completion
FJumpToProcHead.Name:=ANodeExt.Txt; FJumpToProcHead.Name:=ANodeExt.Signature;
FJumpToProcHead.Group:=TPascalMethodGroup(ANodeExt.Flags); FJumpToProcHead.Group:=TPascalMethodGroup(ANodeExt.Flags);
FJumpToProcHead.ResultType:=ANodeExt.ExtTxt4; FJumpToProcHead.ResultType:=ANodeExt.ResultType;
if System.Pos('.',FJumpToProcHead.Name)<1 then if System.Pos('.',FJumpToProcHead.Name)<1 then
FJumpToProcHead.Name:=TheClassName+'.'+FJumpToProcHead.Name; FJumpToProcHead.Name:=TheClassName+'.'+FJumpToProcHead.Name;
if FJumpToProcHead.Name[length(FJumpToProcHead.Name)]<>';' then if FJumpToProcHead.Name[length(FJumpToProcHead.Name)]<>';' then
@ -8807,13 +8810,13 @@ var
begin begin
Beauty:=FSourceChangeCache.BeautifyCodeOptions; Beauty:=FSourceChangeCache.BeautifyCodeOptions;
CheckForOverrideAndAddInheritedCode(TheNodeExt,Indent); CheckForOverrideAndAddInheritedCode(TheNodeExt,Indent);
if (TheNodeExt.ExtTxt1='') and (TheNodeExt.ExtTxt3='') then begin if (TheNodeExt.Code='') and (TheNodeExt.ProcBody='') then begin
ANode:=TheNodeExt.Node; ANode:=TheNodeExt.Node;
if (ANode<>nil) and (ANode.Desc=ctnProcedure) then begin if (ANode<>nil) and (ANode.Desc=ctnProcedure) then begin
ProcCode:=ExtractProcHead(ANode,CreateMethodBodies_ProcAttrBodyDef+[phpWithEmptyParamList]); ProcCode:=ExtractProcHead(ANode,CreateMethodBodies_ProcAttrBodyDef+[phpWithEmptyParamList]);
//debugln(['CreateCodeForMissingProcBody Definition="',ProcCode,'"']); //debugln(['CreateCodeForMissingProcBody Definition="',ProcCode,'"']);
TheNodeExt.ExtTxt3:=Beauty.BeautifyProc(ProcCode,Indent,true); TheNodeExt.ProcBody:=Beauty.BeautifyProc(ProcCode,Indent,true);
//debugln(['CreateCodeForMissingProcBody Beautified="',TheNodeExt.ExtTxt3,'"']); //debugln(['CreateCodeForMissingProcBody Beautified="',TheNodeExt.ProcBody,'"']);
end; end;
end; end;
end; end;
@ -9037,7 +9040,7 @@ var
FirstExistingProcBody:=ANode; FirstExistingProcBody:=ANode;
if ANode.StartPos>LastExistingProcBody.StartPos then if ANode.StartPos>LastExistingProcBody.StartPos then
LastExistingProcBody:=ANode; LastExistingProcBody:=ANode;
//DebugLn(['FindTopMostAndBottomMostProcBodies ',TCodeTreeNodeExtension(ExistingNode.Data).Txt]); //DebugLn(['FindTopMostAndBottomMostProcBodies ',TCodeTreeNodeExtension(ExistingNode.Data).Signature]);
ExistingNode:=ProcBodyNodes.FindSuccessor(ExistingNode); ExistingNode:=ProcBodyNodes.FindSuccessor(ExistingNode);
end; end;
end; end;
@ -9061,8 +9064,8 @@ var
ANode2:=ANodeExt.Node; ANode2:=ANodeExt.Node;
end; end;
debugln(['CheckForDoubleDefinedMethods redefined']); debugln(['CheckForDoubleDefinedMethods redefined']);
debugln(' 1. ',ANodeExt.Txt,' ',CleanPosToStr(ANodeExt.Node.StartPos)); debugln(' 1. ',ANodeExt.Signature,' ',CleanPosToStr(ANodeExt.Node.StartPos));
debugln(' 2. ',ANodeExt2.Txt,' ',CleanPosToStr(ANodeExt2.Node.StartPos)); debugln(' 2. ',ANodeExt2.Signature,' ',CleanPosToStr(ANodeExt2.Node.StartPos));
CleanPosToCaret(ANode.FirstChild.StartPos,Caret1); CleanPosToCaret(ANode.FirstChild.StartPos,Caret1);
CleanPosToCaret(ANode2.FirstChild.StartPos,Caret2); CleanPosToCaret(ANode2.FirstChild.StartPos,Caret2);
s:=IntToStr(Caret2.Y)+','+IntToStr(Caret2.X); s:=IntToStr(Caret2.Y)+','+IntToStr(Caret2.X);
@ -9132,7 +9135,7 @@ begin
{$IFDEF VerboseCreateMissingClassProcBodies} {$IFDEF VerboseCreateMissingClassProcBodies}
debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies get class procs of ',CodeCompleteClassNode.DescAsString]); debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies get class procs of ',CodeCompleteClassNode.DescAsString]);
{$ENDIF} {$ENDIF}
ClassProcs:=GatherClassProcDefinitions(CodeCompleteClassNode,true); ClassProcs:=GatherClassProcDefinitions(CodeCompleteClassNode,true,true);
{$IFDEF VerboseCreateMissingClassProcBodies} {$IFDEF VerboseCreateMissingClassProcBodies}
debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies get bodies of ',CodeCompleteClassNode.DescAsString]); debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies get bodies of ',CodeCompleteClassNode.DescAsString]);
{$ENDIF} {$ENDIF}
@ -9142,13 +9145,13 @@ begin
debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ClassProcs=',ClassProcs.Count]); debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ClassProcs=',ClassProcs.Count]);
AnAVLNode:=ClassProcs.FindLowest; AnAVLNode:=ClassProcs.FindLowest;
while AnAVLNode<>nil do begin while AnAVLNode<>nil do begin
DebugLn(' Gathered ProcDef ',TCodeTreeNodeExtension(AnAVLNode.Data).Txt); DebugLn(' Gathered ProcDef ',TCodeTreeNodeExtension(AnAVLNode.Data).Signature);
AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode); AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode);
end; end;
debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ProcBodyNodes=',ProcBodyNodes.Count]); debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ProcBodyNodes=',ProcBodyNodes.Count]);
AnAVLNode:=ProcBodyNodes.FindLowest; AnAVLNode:=ProcBodyNodes.FindLowest;
while AnAVLNode<>nil do begin while AnAVLNode<>nil do begin
DebugLn(' Gathered ProcBody ',TCodeTreeNodeExtension(AnAVLNode.Data).Txt); DebugLn(' Gathered ProcBody ',TCodeTreeNodeExtension(AnAVLNode.Data).Signature);
AnAVLNode:=ProcBodyNodes.FindSuccessor(AnAVLNode); AnAVLNode:=ProcBodyNodes.FindSuccessor(AnAVLNode);
end; end;
{$ENDIF} {$ENDIF}
@ -9186,7 +9189,7 @@ begin
{$IFDEF VerboseCreateMissingClassProcBodies} {$IFDEF VerboseCreateMissingClassProcBodies}
AnAVLNode:=ClassProcs.FindLowest; AnAVLNode:=ClassProcs.FindLowest;
while AnAVLNode<>nil do begin while AnAVLNode<>nil do begin
DebugLn(' SignaturesUpdated ProcDef ',TCodeTreeNodeExtension(AnAVLNode.Data).Txt); DebugLn(' SignaturesUpdated ProcDef ',TCodeTreeNodeExtension(AnAVLNode.Data).Signature);
AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode); AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode);
end; end;
{$ENDIF} {$ENDIF}
@ -9196,7 +9199,7 @@ begin
{$IFDEF VerboseCreateMissingClassProcBodies} {$IFDEF VerboseCreateMissingClassProcBodies}
AnAVLNode:=ClassProcs.FindLowest; AnAVLNode:=ClassProcs.FindLowest;
while AnAVLNode<>nil do begin while AnAVLNode<>nil do begin
DebugLn(' AfterPropsCompleted ',TCodeTreeNodeExtension(AnAVLNode.Data).Txt); DebugLn(' AfterPropsCompleted ',TCodeTreeNodeExtension(AnAVLNode.Data).Signature);
AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode); AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode);
end; end;
{$ENDIF} {$ENDIF}
@ -9225,12 +9228,12 @@ begin
{$IFDEF VerboseCreateMissingClassProcBodies} {$IFDEF VerboseCreateMissingClassProcBodies}
AnAVLNode:=ClassProcs.FindLowest; AnAVLNode:=ClassProcs.FindLowest;
while AnAVLNode<>nil do begin while AnAVLNode<>nil do begin
DebugLn(' BeforeAddMissing ProcDef "',TCodeTreeNodeExtension(AnAVLNode.Data).Txt,'"'); DebugLn(' BeforeAddMissing ProcDef "',TCodeTreeNodeExtension(AnAVLNode.Data).Signature,'"');
AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode); AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode);
end; end;
AnAVLNode:=ProcBodyNodes.FindLowest; AnAVLNode:=ProcBodyNodes.FindLowest;
while AnAVLNode<>nil do begin while AnAVLNode<>nil do begin
DebugLn(' BeforeAddMissing ProcBody "',TCodeTreeNodeExtension(AnAVLNode.Data).Txt,'"'); DebugLn(' BeforeAddMissing ProcBody "',TCodeTreeNodeExtension(AnAVLNode.Data).Signature,'"');
AnAVLNode:=ProcBodyNodes.FindSuccessor(AnAVLNode); AnAVLNode:=ProcBodyNodes.FindSuccessor(AnAVLNode);
end; end;
{$ENDIF} {$ENDIF}
@ -9252,7 +9255,6 @@ begin
while (MissingNode<>nil) do begin while (MissingNode<>nil) do begin
ANodeExt:=TCodeTreeNodeExtension(MissingNode.Data); ANodeExt:=TCodeTreeNodeExtension(MissingNode.Data);
MissingNode:=ClassProcs.FindPrecessor(MissingNode); MissingNode:=ClassProcs.FindPrecessor(MissingNode);
if ProcNodeHasSpecifier(ANodeExt.Node,psEXTERNAL) then continue;
CreateMethodBodies_CreateCode(ANodeExt,Indent); CreateMethodBodies_CreateCode(ANodeExt,Indent);
CreateMethodBodies_Insert(TheClassName,ANodeExt,InsertPos,Indent); CreateMethodBodies_Insert(TheClassName,ANodeExt,InsertPos,Indent);
end; end;
@ -9277,13 +9279,13 @@ begin
MissingNode:=ClassProcs.FindPrecessor(MissingNode); MissingNode:=ClassProcs.FindPrecessor(MissingNode);
ExistingNode:=ProcBodyNodes.Find(ANodeExt); ExistingNode:=ProcBodyNodes.Find(ANodeExt);
{$IFDEF VerboseCreateMissingClassProcBodies} {$IFDEF VerboseCreateMissingClassProcBodies}
DebugLn(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ANodeExt.Txt=',ANodeExt.Txt,' ExistingNode=',ExistingNode<>nil]); DebugLn(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ANodeExt.Txt=',ANodeExt.Signature,' ExistingNode=',ExistingNode<>nil]);
{$ENDIF} {$ENDIF}
if (ExistingNode=nil) and (not ProcNodeHasSpecifier(ANodeExt.Node,psEXTERNAL)) if (ExistingNode=nil) and (not ProcNodeHasSpecifier(ANodeExt.Node,psEXTERNAL))
then begin then begin
{$IFDEF VerboseCreateMissingClassProcBodies} {$IFDEF VerboseCreateMissingClassProcBodies}
//generates AV: //generates AV:
//DebugLn(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ANodeExt.Txt=',ANodeExt.Txt,' ExistingNode=',TCodeTreeNodeExtension(ExistingNode.Data).Txt]); //DebugLn(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ANodeExt.Txt=',ANodeExt.Signature,' ExistingNode=',TCodeTreeNodeExtension(ExistingNode.Data).Signature]);
{$ENDIF} {$ENDIF}
// MissingNode does not have a body -> insert proc body // MissingNode does not have a body -> insert proc body
case MethodInsertPolicy of case MethodInsertPolicy of
@ -9859,10 +9861,10 @@ begin
// add method data // add method data
NodeExt:=TCodeTreeNodeExtension.Create; NodeExt:=TCodeTreeNodeExtension.Create;
NodeExt.Txt:=CleanProcCode; NodeExt.Signature:=CleanProcCode;
NodeExt.ExtTxt1:=FullProcCode; NodeExt.Code:=FullProcCode;
NodeExt.ExtTxt2:=ProcName; NodeExt.Identifier:=ProcName;
NodeExt.ExtTxt3:=ProcCode; NodeExt.ProcBody:=ProcCode;
NodeExt.Flags:=VisibilityDesc; NodeExt.Flags:=VisibilityDesc;
NewMethods.Add(NodeExt); NewMethods.Add(NodeExt);
//DebugLn(['TCodeCompletionCodeTool.AddMethods ',i,' CleanProcTxt=',CleanProcCode,' FullProcTxt=',FullProcCode]); //DebugLn(['TCodeCompletionCodeTool.AddMethods ',i,' CleanProcTxt=',CleanProcCode,' FullProcTxt=',FullProcCode]);
@ -9898,10 +9900,10 @@ begin
AVLNode:=NewMethods.FindLowest; AVLNode:=NewMethods.FindLowest;
while AVLNode<>nil do begin while AVLNode<>nil do begin
NodeExt:=TCodeTreeNodeExtension(AVLNode.Data); NodeExt:=TCodeTreeNodeExtension(AVLNode.Data);
CleanProcCode:=NodeExt.Txt; CleanProcCode:=NodeExt.Signature;
FullProcCode:=NodeExt.ExtTxt1; FullProcCode:=NodeExt.Code;
ProcName:=NodeExt.ExtTxt2; ProcName:=NodeExt.Identifier;
ProcCode:=NodeExt.ExtTxt3; ProcCode:=NodeExt.ProcBody;
VisibilityDesc:=TCodeTreeNodeDesc(NodeExt.Flags); VisibilityDesc:=TCodeTreeNodeDesc(NodeExt.Flags);
case VisibilityDesc of case VisibilityDesc of
ctnClassPrivate: NewClassPart:=ncpPrivateProcs; ctnClassPrivate: NewClassPart:=ncpPrivateProcs;

View File

@ -351,8 +351,11 @@ type
TCodeTreeNodeExtension = class TCodeTreeNodeExtension = class
public public
Node: TCodeTreeNode; Node: TCodeTreeNode;
Txt: string; Signature: string; // was Txt
ExtTxt1, ExtTxt2, ExtTxt3, ExtTxt4: string; Identifier: string; // the name of the variable or method, was ExtTxt2
Code: string; // was ExtTxt1
ProcBody: string; // was ExtTxt3
ResultType: string; // was ExtTxt4
Position: integer; Position: integer;
Data: Pointer; Data: Pointer;
Flags: cardinal; Flags: cardinal;
@ -626,7 +629,7 @@ function CompareTxtWithCodeTreeNodeExt(p: Pointer; NodeData: pointer
var var
NodeExt: TCodeTreeNodeExtension absolute NodeData; NodeExt: TCodeTreeNodeExtension absolute NodeData;
begin begin
Result:=CompareTextIgnoringSpace(Ansistring(p),NodeExt.Txt,false); Result:=CompareTextIgnoringSpace(Ansistring(p),NodeExt.Signature,false);
end; end;
function CompareIdentifierWithCodeTreeNodeExt(p: Pointer; NodeData: pointer function CompareIdentifierWithCodeTreeNodeExt(p: Pointer; NodeData: pointer
@ -635,7 +638,7 @@ var
NodeExt: TCodeTreeNodeExtension absolute NodeData; NodeExt: TCodeTreeNodeExtension absolute NodeData;
begin begin
NodeExt:=TCodeTreeNodeExtension(NodeData); NodeExt:=TCodeTreeNodeExtension(NodeData);
Result:=CompareIdentifiers(p,PChar(NodeExt.Txt)); Result:=CompareIdentifiers(p,PChar(NodeExt.Signature));
end; end;
function CompareCodeTreeNodeExt(NodeData1, NodeData2: pointer): integer; function CompareCodeTreeNodeExt(NodeData1, NodeData2: pointer): integer;
@ -643,7 +646,7 @@ var
NodeExt1: TCodeTreeNodeExtension absolute NodeData1; NodeExt1: TCodeTreeNodeExtension absolute NodeData1;
NodeExt2: TCodeTreeNodeExtension absolute NodeData2; NodeExt2: TCodeTreeNodeExtension absolute NodeData2;
begin begin
Result:=CompareTextIgnoringSpace(NodeExt1.Txt,NodeExt2.Txt,false); Result:=CompareTextIgnoringSpace(NodeExt1.Signature,NodeExt2.Signature,false);
end; end;
function CompareCodeTreeNodeExtWithPos(NodeData1, NodeData2: pointer): integer; function CompareCodeTreeNodeExtWithPos(NodeData1, NodeData2: pointer): integer;
@ -679,7 +682,7 @@ var
NodeExt1: TCodeTreeNodeExtension absolute NodeData1; NodeExt1: TCodeTreeNodeExtension absolute NodeData1;
NodeExt2: TCodeTreeNodeExtension absolute NodeData2; NodeExt2: TCodeTreeNodeExtension absolute NodeData2;
begin begin
Result:=CompareTextIgnoringSpace(NodeExt1.Txt,NodeExt2.Txt,false); Result:=CompareTextIgnoringSpace(NodeExt1.Signature,NodeExt2.Signature,false);
if Result<>0 then exit; if Result<>0 then exit;
if NodeExt1.Position<NodeExt2.Position then if NodeExt1.Position<NodeExt2.Position then
Result:=1 Result:=1
@ -1179,11 +1182,11 @@ end;
procedure TCodeTreeNodeExtension.Clear; procedure TCodeTreeNodeExtension.Clear;
begin begin
Next:=nil; Next:=nil;
Txt:=''; Signature:='';
ExtTxt1:=''; Code:='';
ExtTxt2:=''; Identifier:='';
ExtTxt3:=''; ProcBody:='';
ExtTxt4:=''; ResultType:='';
Node:=nil; Node:=nil;
Position:=-1; Position:=-1;
Data:=nil; Data:=nil;
@ -1209,18 +1212,18 @@ begin
DbgOut('Node=',NodeDescriptionAsString(Node.Desc)) DbgOut('Node=',NodeDescriptionAsString(Node.Desc))
else else
DbgOut('Node=nil'); DbgOut('Node=nil');
DbgOut(' Position=',dbgs(Position),' Txt="'+Txt+'" ExtTxt1="'+ExtTxt1+'" ExtTxt2="'+ExtTxt2+'" ExtTxt3="'+ExtTxt3+'" ExtTxt4="'+ExtTxt4+'"'); DbgOut(' Position=',dbgs(Position),' Txt="'+Signature+'" ExtTxt1="'+Code+'" ExtTxt2="'+Identifier+'" ExtTxt3="'+ProcBody+'" ExtTxt4="'+ResultType+'"');
debugln; debugln;
end; end;
function TCodeTreeNodeExtension.CalcMemSize: PtrUInt; function TCodeTreeNodeExtension.CalcMemSize: PtrUInt;
begin begin
Result:=PtrUInt(InstanceSize) Result:=PtrUInt(InstanceSize)
+MemSizeString(Txt) +MemSizeString(Signature)
+MemSizeString(ExtTxt1) +MemSizeString(Code)
+MemSizeString(ExtTxt2) +MemSizeString(Identifier)
+MemSizeString(ExtTxt3) +MemSizeString(ProcBody)
+MemSizeString(ExtTxt4); +MemSizeString(ResultType);
end; end;
end. end.

View File

@ -245,9 +245,9 @@ begin
NextAVLNode:=FMemberNodeExts.FindSuccessor(AVLNode); NextAVLNode:=FMemberNodeExts.FindSuccessor(AVLNode);
NodeExt:=TCodeTreeNodeExtension(AVLNode.Data); NodeExt:=TCodeTreeNodeExtension(AVLNode.Data);
AssignIt:=true; AssignIt:=true;
if (NodeExt.Txt='') then AssignIt:=false; if (NodeExt.Signature='') then AssignIt:=false;
if AssignIt then begin if AssignIt then begin
FoundAVLNode:=FItems.FindKey(PChar(NodeExt.Txt),@CompareAnsistringWithAAMDItemName); FoundAVLNode:=FItems.FindKey(PChar(NodeExt.Signature),@CompareAnsistringWithAAMDItemName);
if FoundAVLNode<>nil then begin if FoundAVLNode<>nil then begin
Item:=TAAMDItem(FoundAVLNode.Data); Item:=TAAMDItem(FoundAVLNode.Data);
AssignIt:=Item.Selected; AssignIt:=Item.Selected;
@ -503,7 +503,7 @@ begin
// kind // kind
Item.Desc:=NodeExt.Node.Desc; Item.Desc:=NodeExt.Node.Desc;
// name // name
Item.Name:=NodeExt.Txt; Item.Name:=NodeExt.Signature;
// written by property // written by property
if NodeExt.Data<>nil then if NodeExt.Data<>nil then
Item.WrittenByProperty:=FTool.ExtractPropName(TCodeTreeNode(NodeExt.Data),false) Item.WrittenByProperty:=FTool.ExtractPropName(TCodeTreeNode(NodeExt.Data),false)

View File

@ -3857,7 +3857,7 @@ var
NodeExt:=TCodeTreeNodeExtension.Create; NodeExt:=TCodeTreeNodeExtension.Create;
NodeExt.Node:=ProcNode; NodeExt.Node:=ProcNode;
NodeExt.Data:=ATool; NodeExt.Data:=ATool;
NodeExt.Txt:=ProcText; NodeExt.Signature:=ProcText;
if IsAbstract then if IsAbstract then
NodeExt.Flags:=FlagIsAbstract NodeExt.Flags:=FlagIsAbstract
else else

View File

@ -143,7 +143,7 @@ begin
NodeExt1:=TCodeTreeNodeExtension(AVLNode1.Data); NodeExt1:=TCodeTreeNodeExtension(AVLNode1.Data);
if AVLNode2<>nil then begin if AVLNode2<>nil then begin
NodeExt2:=TCodeTreeNodeExtension(AVLNode2.Data); NodeExt2:=TCodeTreeNodeExtension(AVLNode2.Data);
cmp:=CompareTextIgnoringSpace(NodeExt1.Txt,NodeExt2.Txt,false); cmp:=CompareTextIgnoringSpace(NodeExt1.Signature,NodeExt2.Signature,false);
if cmp<0 then begin if cmp<0 then begin
// node of tree1 does not exist in tree2 // node of tree1 does not exist in tree2
// -> delete // -> delete
@ -836,11 +836,11 @@ begin
NewNodeExt:=TCodeTreeNodeExtension.Create; NewNodeExt:=TCodeTreeNodeExtension.Create;
with NewNodeExt do begin with NewNodeExt do begin
Node:=ANode; Node:=ANode;
Txt:=CurProcName; Signature:=CurProcName;
Flags:=Ord(ExtractProcedureGroup(ANode)); Flags:=Ord(ExtractProcedureGroup(ANode));
if TPascalMethodGroup(Flags)=mgClassOperator then if TPascalMethodGroup(Flags)=mgClassOperator then
// for class operator the result type is part of the signature // for class operator the result type is part of the signature
ExtTxt4:=ExtractFuncResultType(ANode,Attr); ResultType:=ExtractFuncResultType(ANode,Attr);
end; end;
Result.Add(NewNodeExt); Result.Add(NewNodeExt);
end; end;
@ -884,15 +884,15 @@ begin
//DebugLn('[TMethodJumpingCodeTool.FindFirstDifferenceNode] B ',SearchInNode<>nil); //DebugLn('[TMethodJumpingCodeTool.FindFirstDifferenceNode] B ',SearchInNode<>nil);
cmp:=CompareCodeTreeNodeExt(Result.Data,SearchInNode.Data); cmp:=CompareCodeTreeNodeExt(Result.Data,SearchInNode.Data);
//NodeTxt1:=TCodeTreeNodeExtension(Result.Data).Txt; //NodeTxt1:=TCodeTreeNodeExtension(Result.Data).Signature;
//NodeTxt2:=TCodeTreeNodeExtension(SearchInNode.Data).Txt; //NodeTxt2:=TCodeTreeNodeExtension(SearchInNode.Data).Signature;
//DebugLn('[TMethodJumpingCodeTool.FindFirstDifferenceNode] ',NodeTxt1,' ?',cmp,'= ',NodeTxt2); //DebugLn('[TMethodJumpingCodeTool.FindFirstDifferenceNode] ',NodeTxt1,' ?',cmp,'= ',NodeTxt2);
if cmp<0 then begin if cmp<0 then begin
// result node not found in SearchInNodes // result node not found in SearchInNodes
// -> search for first difference // -> search for first difference
//NodeTxt1:=TCodeTreeNodeExtension(Result.Data).Txt; //NodeTxt1:=TCodeTreeNodeExtension(Result.Data).Signature;
//NodeTxt2:=TCodeTreeNodeExtension(SearchInNode.Data).Txt; //NodeTxt2:=TCodeTreeNodeExtension(SearchInNode.Data).Signature;
Attr:=[phpWithStart, phpWithoutClassName, phpWithVarModifiers, Attr:=[phpWithStart, phpWithoutClassName, phpWithVarModifiers,
phpWithResultType, phpInUpperCase]; phpWithResultType, phpInUpperCase];
NodeTxt1:=ExtractProcHead(TCodeTreeNodeExtension(Result.Data).Node,Attr); NodeTxt1:=ExtractProcHead(TCodeTreeNodeExtension(Result.Data).Node,Attr);
@ -938,7 +938,7 @@ begin
ANode:=ATree.Root; ANode:=ATree.Root;
while ANode<>nil do begin while ANode<>nil do begin
Result:=TCodeTreeNodeExtension(ANode.Data); Result:=TCodeTreeNodeExtension(ANode.Data);
cmp:=CompareTextIgnoringSpace(UpperCode,Result.Txt,true); cmp:=CompareTextIgnoringSpace(UpperCode,Result.Signature,true);
if cmp<0 then if cmp<0 then
ANode:=ANode.Left ANode:=ANode.Left
else if cmp>0 then else if cmp>0 then
@ -1210,9 +1210,9 @@ begin
end else end else
DbgOut('Node=nil'); DbgOut('Node=nil');
DbgOut(' Position=',Dbgs(ANodeExt.Position)); DbgOut(' Position=',Dbgs(ANodeExt.Position));
DbgOut(' Txt="',ANodeExt.Txt,'"'); DbgOut(' Txt="',ANodeExt.Signature,'"');
DbgOut(' ExtTxt1="',ANodeExt.ExtTxt1,'"'); DbgOut(' ExtTxt1="',ANodeExt.Code,'"');
DbgOut(' ExtTxt2="',ANodeExt.ExtTxt2,'"'); DbgOut(' ExtTxt2="',ANodeExt.Identifier,'"');
DebugLn(); DebugLn();
AVLNode:=ExtTree.FindSuccessor(AVLNode); AVLNode:=ExtTree.FindSuccessor(AVLNode);
end; end;

View File

@ -399,8 +399,8 @@ var
NodeExt2: TCodeTreeNodeExtension absolute NodeData2; NodeExt2: TCodeTreeNodeExtension absolute NodeData2;
begin begin
Result := CompareMethodHeaders( Result := CompareMethodHeaders(
NodeExt1.Txt,TPascalMethodGroup(NodeExt1.Flags),NodeExt1.ExtTxt4, NodeExt1.Signature,TPascalMethodGroup(NodeExt1.Flags),NodeExt1.ResultType,
NodeExt2.Txt,TPascalMethodGroup(NodeExt2.Flags),NodeExt2.ExtTxt4); NodeExt2.Signature,TPascalMethodGroup(NodeExt2.Flags),NodeExt2.ResultType);
end; end;

View File

@ -4818,7 +4818,7 @@ function TStandardCodeTool.GatherPublishedClassElements(
NewNodeExt:=TCodeTreeNodeExtension.Create; NewNodeExt:=TCodeTreeNodeExtension.Create;
with NewNodeExt do begin with NewNodeExt do begin
Node:=ANode; Node:=ANode;
Txt:=CurProcName; Signature:=CurProcName;
end; end;
TreeOfCodeTreeNodeExtension.Add(NewNodeExt); TreeOfCodeTreeNodeExtension.Add(NewNodeExt);
end end
@ -4827,7 +4827,7 @@ function TStandardCodeTool.GatherPublishedClassElements(
NewNodeExt:=TCodeTreeNodeExtension.Create; NewNodeExt:=TCodeTreeNodeExtension.Create;
with NewNodeExt do begin with NewNodeExt do begin
Node:=ANode; Node:=ANode;
Txt:=CurVarName; Signature:=CurVarName;
end; end;
TreeOfCodeTreeNodeExtension.Add(NewNodeExt); TreeOfCodeTreeNodeExtension.Add(NewNodeExt);
end end
@ -4836,7 +4836,7 @@ function TStandardCodeTool.GatherPublishedClassElements(
NewNodeExt:=TCodeTreeNodeExtension.Create; NewNodeExt:=TCodeTreeNodeExtension.Create;
with NewNodeExt do begin with NewNodeExt do begin
Node:=ANode; Node:=ANode;
Txt:=CurPropName; Signature:=CurPropName;
end; end;
TreeOfCodeTreeNodeExtension.Add(NewNodeExt); TreeOfCodeTreeNodeExtension.Add(NewNodeExt);
end; end;