mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 08:59:32 +02:00
codetools: clean up
git-svn-id: trunk@56361 -
This commit is contained in:
parent
0e12730671
commit
87da0fc570
@ -754,8 +754,6 @@ type
|
||||
const ClassContext, AncestorClassContext: TFindContext;
|
||||
{%H-}LFMNode: TLFMTreeNode;
|
||||
const IdentName: string; var IsDefined: boolean);
|
||||
function UpdateComponentInit(Code: TCodeBuffer; const aClassName,
|
||||
AccessClass, StartSignature, EndSignature, InitSrc: string): boolean;
|
||||
|
||||
// register proc
|
||||
function HasInterfaceRegisterProc(Code: TCodeBuffer;
|
||||
@ -5385,23 +5383,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCodeToolManager.UpdateComponentInit(Code: TCodeBuffer;
|
||||
const aClassName, AccessClass, StartSignature, EndSignature, InitSrc: string
|
||||
): boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn(['TCodeToolManager.UpdateComponentInit A ',Code.Filename,' Class="'+aClassName+'" AccessClass="'+AccessClass+'" StartSignature="'+StartSignature+'" EndSignature="'+EndSignature+'" InitSrc={'+InitSrc+'}']);
|
||||
{$ENDIF}
|
||||
if not InitCurCodeTool(Code) then exit;
|
||||
try
|
||||
Result:=FCurCodeTool.UpdateComponentInit(aClassName,AccessClass,
|
||||
StartSignature,EndSignature,InitSrc,SourceChangeCache);
|
||||
except
|
||||
on e: Exception do Result:=HandleException(e);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCodeToolManager.FindCreateFormStatement(Code: TCodeBuffer;
|
||||
StartPos: integer;
|
||||
const AClassName, AVarName: string;
|
||||
|
@ -124,10 +124,6 @@ type
|
||||
const WithExpr: string; // if empty: collect Candidates
|
||||
Candidates: TStrings; SourceChangeCache: TSourceChangeCache): boolean;
|
||||
|
||||
function UpdateComponentInit(const aClassName, AccessClass,
|
||||
StartSignature, EndSignature, InitSrc: string;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
|
||||
procedure CalcMemSize(Stats: TCTMemStats); override;
|
||||
end;
|
||||
|
||||
@ -1700,35 +1696,6 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TExtractProcTool.UpdateComponentInit(const aClassName, AccessClass,
|
||||
StartSignature, EndSignature, InitSrc: string;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
|
||||
procedure E(TheID: int64; Msg: string);
|
||||
begin
|
||||
raise ECodeToolError.Create(Self,TheID,'TExtractProcTool.UpdateComponentInit: '+Msg);
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=false;
|
||||
{$IFDEF VerboseCompWriterPas}
|
||||
debugln(['TExtractProcTool.UpdateComponentInit START ',MainFilename,' aClassName="'+aClassName+'" AccessClass="'+AccessClass+'" StartSignature={'+DbgStr(StartSignature)+'} EndSignature={'+dbgstr(EndSignature)+'} InitSrc={'+InitSrc+'}']);
|
||||
{$ENDIF}
|
||||
if aClassName='' then
|
||||
E(20171025224428,'missing aClassName');
|
||||
if not IsValidIdent(aClassName) then
|
||||
E(20171025224540,'invalid aClassName "'+aClassName+'"');
|
||||
if (AccessClass<>'') and not IsValidIdent(AccessClass) then
|
||||
E(20171025224607,'invalid AccessClass "'+AccessClass+'"');
|
||||
if StartSignature='' then
|
||||
E(20171025224636,'missing StartSignature');
|
||||
if EndSignature='' then
|
||||
E(20171025224647,'missing EndSignature');
|
||||
|
||||
// find class
|
||||
// ToDo
|
||||
end;
|
||||
|
||||
procedure TExtractProcTool.CalcMemSize(Stats: TCTMemStats);
|
||||
begin
|
||||
inherited CalcMemSize(Stats);
|
||||
|
@ -30,7 +30,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, typinfo, LazLoggerBase, LazUTF8, LazLogger, CompWriterPas,
|
||||
LazPasReadUtil, fpcunit, testregistry, CodeToolManager, LinkScanner,
|
||||
CodeToolsStructs, CodeCache, BasicCodeTools, TestStdCodetools, TestGlobals,
|
||||
CodeToolsStructs, TestStdCodetools,
|
||||
variants;
|
||||
|
||||
// Tests =======================================================================
|
||||
@ -484,8 +484,6 @@ type
|
||||
procedure TestDesignInfo;
|
||||
procedure TestDefineProperties_ListOfStrings;
|
||||
procedure Test_TStrings;
|
||||
|
||||
procedure TestFindComponentInit; // ToDo
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -2190,45 +2188,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestCompReaderWriterPas.TestFindComponentInit;
|
||||
var
|
||||
Code: TCodeBuffer;
|
||||
Init, IndentedInit, Src: String;
|
||||
begin
|
||||
exit;
|
||||
|
||||
Code:=CodeToolBoss.CreateFile('form1.pas');
|
||||
Init:='Name:=''Form1'';'+LineEnding;
|
||||
IndentText(CSPDefaultSignatureBegin+LineEnding
|
||||
+Init
|
||||
+CSPDefaultSignatureEnd+LineEnding,2,8,IndentedInit);
|
||||
Src:=LinesToStr(['unit Unit1;'
|
||||
,'{$mode objfpc}{$H+}'
|
||||
,'interface'
|
||||
,'uses Classes;'
|
||||
,'type'
|
||||
,' TForm1 = class(TComponent)'
|
||||
,' public'
|
||||
,' constructor Create(TheOwner: TComponent); override;'
|
||||
,' end;'
|
||||
,'implementation'
|
||||
,'type'
|
||||
,' '+CSPDefaultAccessClass+' = class(TComponent);'
|
||||
,'constructor TForm.Create(TheOwner: TComponent);'
|
||||
,'begin'+LineEnding
|
||||
,' inherited;'])
|
||||
+IndentedInit
|
||||
+LinesToStr(['end;'
|
||||
,'end.']);
|
||||
Code.Source:=Src;
|
||||
if not CodeToolBoss.UpdateComponentInit(Code,'TForm1',CSPDefaultAccessClass,
|
||||
CSPDefaultSignatureBegin,CSPDefaultSignatureEnd,Init)
|
||||
then begin
|
||||
Fail('CodeToolBoss.UpdateComponentInit failed');
|
||||
end;
|
||||
CheckDiff('TestFindComponentInit',Src,Code.Source);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterTest(TTestCompReaderWriterPas);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user