IDE: Rename FindComponentClass -> SearchComponentClass to differentiate from other functions with the same name.

This commit is contained in:
Juha 2021-11-26 21:16:42 +02:00
parent ba91c73a64
commit 1c6662a681

View File

@ -288,7 +288,7 @@ function SaveEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean;
function LoadAncestorDependencyHidden(AnUnitInfo: TUnitInfo;
const aComponentClassName: string; OpenFlags: TOpenFlags;
out AncestorClass: TComponentClass; out AncestorUnitInfo: TUnitInfo): TModalResult;
// function FindComponentClass(AnUnitInfo: TUnitInfo; const AComponentClassName: string;
// function SearchComponentClass(AnUnitInfo: TUnitInfo; const AComponentClassName: string;
// Quiet: boolean; out ComponentUnitInfo: TUnitInfo; out AComponentClass: TComponentClass;
// out LFMFilename: string; out AncestorClass: TComponentClass): TModalResult;
function LoadComponentDependencyHidden(AnUnitInfo: TUnitInfo;
@ -6065,11 +6065,7 @@ begin
NestedUnitInfo:=nil;
Result:=LoadComponentDependencyHidden(AnUnitInfo,NestedClassName,
OpenFlags,
{$IFDEF EnableNestedComponentsWithoutLFM}
false,
{$ELSE}
true,
{$ENDIF}
{$IFDEF EnableNestedComponentsWithoutLFM}false,{$ELSE}true,{$ENDIF}
NestedClass,NestedUnitInfo,AncestorClass);
if Result<>mrOk then begin
DebugLn(['LoadLFM DoLoadComponentDependencyHidden NestedClassName=',NestedClassName,' failed for ',AnUnitInfo.Filename]);
@ -6518,7 +6514,7 @@ begin
Result:=mrOk;
end;
function FindComponentClass(AnUnitInfo: TUnitInfo; const AComponentClassName: string;
function SearchComponentClass(AnUnitInfo: TUnitInfo; const AComponentClassName: string;
Quiet: boolean; out ComponentUnitInfo: TUnitInfo; out AComponentClass: TComponentClass;
out LFMFilename: string; out AncestorClass: TComponentClass): TModalResult;
{ Possible results:
@ -6575,7 +6571,7 @@ var
CurUnitInfo:=Project1.UnitInfoWithFilename(UnitFilename);
if (CurUnitInfo=nil) or (CurUnitInfo.Component=nil) then exit;
// unit with loaded component found -> check if it is the right one
//DebugLn(['FindComponentClass unit with a component found CurUnitInfo=',CurUnitInfo.Filename,' ',dbgsName(CurUnitInfo.Component)]);
//DebugLn(['SearchComponentClass unit with a component found CurUnitInfo=',CurUnitInfo.Filename,' ',dbgsName(CurUnitInfo.Component)]);
if SysUtils.CompareText(CurUnitInfo.Component.ClassName,AComponentClassName)<>0
then exit;
// component found (it was already loaded)
@ -6608,7 +6604,7 @@ var
if FoundComponentClass=nil then
FoundComponentClass:=FormEditor1.FindDesignerBaseClassByName(aClassName,true);
if FoundComponentClass<>nil then begin
DebugLn(['FindComponentClass.TryRegisteredClasses found: ',FoundComponentClass.ClassName]);
DebugLn(['SearchComponentClass.TryRegisteredClasses found: ',FoundComponentClass.ClassName]);
TheModalResult:=mrOk;
Result:=true;
end;
@ -6654,7 +6650,7 @@ var
TheModalResult:=LoadCodeBuffer(LFMCode,CurLFMFilename,[lbfCheckIfText],true);
if TheModalResult<>mrOk then
begin
debugln('FindComponentClass Failed loading ',CurLFMFilename);
DebugLn('SearchComponentClass Failed loading ',CurLFMFilename);
exit;
end;
// read the LFM classname
@ -6736,7 +6732,7 @@ var
// parse interface current unit
Code:=CodeToolBoss.LoadFile(AnUnitInfo.Filename,false,false);
if Code=nil then begin
debugln(['FindComponentClass unable to load ',AnUnitInfo.Filename]);
DebugLn(['SearchComponentClass unable to load ',AnUnitInfo.Filename]);
exit;
end;
if not CodeToolBoss.Explore(Code,Tool,false,true) then begin
@ -6756,7 +6752,7 @@ var
Node:=Tool.Tree.Root;
Node:=FindTypeNode(Node,0);
if Node=nil then begin
debugln('FindComponentClass Failed finding reference of ',AComponentClassName,' in ',Code.Filename);
DebugLn('SearchComponentClass Failed finding reference of ',AComponentClassName,' in ',Code.Filename);
exit;
end;
if Node.Desc=ctnIdentifier then begin
@ -6768,7 +6764,7 @@ var
fdfIgnoreCurContextNode];
Params.SetIdentifier(Tool,@Tool.Src[Node.StartPos],nil);
if not Tool.FindIdentifierInContext(Params) then begin
debugln(['FindComponentClass find declaration failed at ',Tool.CleanPosToStr(Node.StartPos,true)]);
DebugLn(['SearchComponentClass find declaration failed at ',Tool.CleanPosToStr(Node.StartPos,true)]);
exit;
end;
NewNode:=Params.NewNode;
@ -6794,7 +6790,7 @@ var
if (NewNode.Desc<>ctnTypeDefinition)
or (ClassNode=nil) or (ClassNode.Desc<>ctnClass) then
begin
debugln(['FindComponentClass ',AComponentClassName,' is not a class at ',NewTool.CleanPosToStr(NewNode.StartPos,true)]);
DebugLn(['SearchComponentClass ',AComponentClassName,' is not a class at ',NewTool.CleanPosToStr(NewNode.StartPos,true)]);
exit;
end;
// find inheritance list
@ -6802,7 +6798,7 @@ var
while (InheritedNode<>nil) and (InheritedNode.Desc<>ctnClassInheritance) do
InheritedNode:=InheritedNode.NextBrother;
if (InheritedNode=nil) or (InheritedNode.FirstChild=nil) then begin
debugln(['FindComponentClass ',AComponentClassName,' is not a TComponent at ',NewTool.CleanPosToStr(NewNode.StartPos,true)]);
DebugLn(['SearchComponentClass ',AComponentClassName,' is not a TComponent at ',NewTool.CleanPosToStr(NewNode.StartPos,true)]);
exit;
end;
StoreComponentClassDeclaration(NewTool.MainFilename);
@ -6849,7 +6845,7 @@ var
end;
Code:=CodeToolBoss.LoadFile(UnitFilename,true,false);
if Code=nil then begin
debugln(['FindComponentClass unable to load ',AnUnitInfo.Filename]);
DebugLn(['SearchComponentClass unable to load ',AnUnitInfo.Filename]);
exit;
end;
if not CodeToolBoss.FindFormAncestor(Code,AComponentClassName,AncestorClassName,true) then
@ -6887,13 +6883,13 @@ begin
if not IsValidIdent(AComponentClassName) then
begin
DebugLn(['FindComponentClass invalid component class name "',AComponentClassName,'"']);
DebugLn(['SearchComponentClass invalid component class name "',AComponentClassName,'"']);
exit(mrCancel);
end;
// search component lfm
{$ifdef VerboseFormEditor}
debugln('FindComponentClass START ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName);
DebugLn('SearchComponentClass START ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName);
{$endif}
// first search the resource of AnUnitInfo
if AnUnitInfo<>nil then begin
@ -6914,7 +6910,7 @@ begin
{$IFDEF VerboseLFMSearch}
if (UsedUnitFilenames=nil) or (UsedUnitFilenames.Count=0) then
debugln(['FindComponentClass unit has no main uses']);
DebugLn(['SearchComponentClass unit has no main uses']);
{$ENDIF}
if (UsedUnitFilenames<>nil) then begin
@ -7056,7 +7052,7 @@ begin
Quiet:=([ofProjectLoading,ofQuiet]*Flags<>[]);
HideAbort:=not (ofProjectLoading in Flags);
{ Will be checked in FindComponentClass()
{ Will be checked in SearchComponentClass()
if not IsValidIdent(AComponentClassName) then
begin
DebugLn(['LoadComponentDependencyHidden invalid component class name "',AComponentClassName,'"']);
@ -7079,7 +7075,7 @@ begin
debugln('LoadComponentDependencyHidden ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName,
' AComponentClass=',dbgsName(AComponentClass));
{$endif}
Result:=FindComponentClass(AnUnitInfo,AComponentClassName,Quiet,
Result:=SearchComponentClass(AnUnitInfo,AComponentClassName,Quiet,
ComponentUnitInfo,AComponentClass,LFMFilename,AncestorClass);
{ $if defined(VerboseFormEditor) or defined(VerboseLFMSearch)}
debugln('LoadComponentDependencyHidden ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName,