mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-07 01:38:14 +02:00
codetools: clean up
git-svn-id: trunk@31210 -
This commit is contained in:
parent
d5a9fc581d
commit
faef63fad1
@ -54,7 +54,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, BasicCodeTools, AVL_Tree, KeywordFuncLists, FileProcs,
|
Classes, SysUtils, BasicCodeTools, AVL_Tree, KeywordFuncLists, FileProcs,
|
||||||
typinfo, CodeToolsStrConsts;
|
CodeToolsStrConsts;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCTCSValueType = (
|
TCTCSValueType = (
|
||||||
@ -975,17 +975,17 @@ end;
|
|||||||
|
|
||||||
function dbgs(const t: TCTCfgScriptStackItemType): string;
|
function dbgs(const t: TCTCfgScriptStackItemType): string;
|
||||||
begin
|
begin
|
||||||
Result:=GetEnumName(typeinfo(t),ord(t));
|
str(t,Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function dbgs(const t: TCTCSValueType): string;
|
function dbgs(const t: TCTCSValueType): string;
|
||||||
begin
|
begin
|
||||||
Result:=GetEnumName(typeinfo(t),ord(t));
|
str(t,Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function dbgs(const t: TCTCfgScriptOperator): string;
|
function dbgs(const t: TCTCfgScriptOperator): string;
|
||||||
begin
|
begin
|
||||||
Result:=GetEnumName(typeinfo(t),ord(t));
|
str(t,Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function dbgs(const V: PCTCfgScriptVariable): string;
|
function dbgs(const V: PCTCfgScriptVariable): string;
|
||||||
|
@ -178,29 +178,6 @@ const
|
|||||||
fdfDefaultForExpressions = [fdfSearchInParentNodes, fdfSearchInAncestors,
|
fdfDefaultForExpressions = [fdfSearchInParentNodes, fdfSearchInAncestors,
|
||||||
fdfExceptionOnNotFound];
|
fdfExceptionOnNotFound];
|
||||||
|
|
||||||
// for nicer output
|
|
||||||
FindDeclarationFlagNames: array[TFindDeclarationFlag] of string = (
|
|
||||||
'fdfSearchInAncestors',
|
|
||||||
'fdfSearchInParentNodes',
|
|
||||||
'fdfIgnoreCurContextNode',
|
|
||||||
'fdfIgnoreUsedUnits',
|
|
||||||
'fdfSearchForward',
|
|
||||||
'fdfExceptionOnNotFound',
|
|
||||||
'fdfExceptionOnPredefinedIdent',
|
|
||||||
'fdfIgnoreClassVisibility',
|
|
||||||
'fdfIgnoreMissingParams',
|
|
||||||
'fdfOnlyCompatibleProc',
|
|
||||||
'fdfIgnoreOverloadedProcs',
|
|
||||||
'fdfFindVariable',
|
|
||||||
'fdfFunctionResult',
|
|
||||||
'fdfEnumIdentifier',
|
|
||||||
'fdfFindChilds',
|
|
||||||
'fdfSkipClassForward',
|
|
||||||
'fdfCollect',
|
|
||||||
'fdfTopLvlResolving',
|
|
||||||
'fdfDoNotCache'
|
|
||||||
);
|
|
||||||
|
|
||||||
type
|
type
|
||||||
// flags/states for result
|
// flags/states for result
|
||||||
TFoundDeclarationFlag = (
|
TFoundDeclarationFlag = (
|
||||||
@ -208,11 +185,6 @@ type
|
|||||||
);
|
);
|
||||||
TFoundDeclarationFlags = set of TFoundDeclarationFlag;
|
TFoundDeclarationFlags = set of TFoundDeclarationFlag;
|
||||||
|
|
||||||
const
|
|
||||||
FoundDeclarationFlagNames: array[TFoundDeclarationFlag] of string = (
|
|
||||||
'fodDoNotCache'
|
|
||||||
);
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
type
|
type
|
||||||
TFindDeclarationParams = class;
|
TFindDeclarationParams = class;
|
||||||
@ -899,7 +871,9 @@ function dbgsFC(const Context: TFindContext): string;
|
|||||||
|
|
||||||
function PredefinedIdentToExprTypeDesc(Identifier: PChar): TExpressionTypeDesc;
|
function PredefinedIdentToExprTypeDesc(Identifier: PChar): TExpressionTypeDesc;
|
||||||
function dbgs(const Flags: TFindDeclarationFlags): string; overload;
|
function dbgs(const Flags: TFindDeclarationFlags): string; overload;
|
||||||
|
function dbgs(const Flag: TFindDeclarationFlag): string; overload;
|
||||||
function dbgs(const Flags: TFoundDeclarationFlags): string; overload;
|
function dbgs(const Flags: TFoundDeclarationFlags): string; overload;
|
||||||
|
function dbgs(const Flag: TFoundDeclarationFlag): string; overload;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -914,11 +888,16 @@ begin
|
|||||||
if Flag in Flags then begin
|
if Flag in Flags then begin
|
||||||
if Result<>'' then
|
if Result<>'' then
|
||||||
Result:=Result+', ';
|
Result:=Result+', ';
|
||||||
Result:=Result+FindDeclarationFlagNames[Flag];
|
Result:=Result+dbgs(Flag);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function dbgs(const Flag: TFindDeclarationFlag): string;
|
||||||
|
begin
|
||||||
|
str(Flag,Result);
|
||||||
|
end;
|
||||||
|
|
||||||
function dbgs(
|
function dbgs(
|
||||||
const Flags: TFoundDeclarationFlags): string;
|
const Flags: TFoundDeclarationFlags): string;
|
||||||
var Flag: TFoundDeclarationFlag;
|
var Flag: TFoundDeclarationFlag;
|
||||||
@ -928,11 +907,16 @@ begin
|
|||||||
if Flag in Flags then begin
|
if Flag in Flags then begin
|
||||||
if Result<>'' then
|
if Result<>'' then
|
||||||
Result:=Result+', ';
|
Result:=Result+', ';
|
||||||
Result:=Result+FoundDeclarationFlagNames[Flag];
|
Result:=Result+dbgs(Flag);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function dbgs(const Flag: TFoundDeclarationFlag): string;
|
||||||
|
begin
|
||||||
|
str(Flag,Result);
|
||||||
|
end;
|
||||||
|
|
||||||
function ListOfPFindContextToStr(const ListOfPFindContext: TFPList): string;
|
function ListOfPFindContextToStr(const ListOfPFindContext: TFPList): string;
|
||||||
var
|
var
|
||||||
Context: TFindContext;
|
Context: TFindContext;
|
||||||
|
@ -582,23 +582,6 @@ var
|
|||||||
PSourceLinkMemManager: TPSourceLinkMemManager;
|
PSourceLinkMemManager: TPSourceLinkMemManager;
|
||||||
PSourceChangeStepMemManager: TPSourceChangeStepMemManager;
|
PSourceChangeStepMemManager: TPSourceChangeStepMemManager;
|
||||||
|
|
||||||
const
|
|
||||||
LinkScannerRangeNames: array[TLinkScannerRange] of string = (
|
|
||||||
'lsrNone',
|
|
||||||
'lsrInit',
|
|
||||||
'lsrSourceType',
|
|
||||||
'lsrSourceName',
|
|
||||||
'lsrInterfaceStart',
|
|
||||||
'lsrMainUsesSectionStart',
|
|
||||||
'lsrMainUsesSectionEnd',
|
|
||||||
'lsrImplementationStart',
|
|
||||||
'lsrImplementationUsesSectionStart',
|
|
||||||
'lsrImplementationUsesSectionEnd',
|
|
||||||
'lsrInitializationStart',
|
|
||||||
'lsrFinalizationStart',
|
|
||||||
'lsrEnd'
|
|
||||||
);
|
|
||||||
|
|
||||||
procedure AddCodeToUniqueList(ACode: Pointer; UniqueSortedCodeList: TFPList);
|
procedure AddCodeToUniqueList(ACode: Pointer; UniqueSortedCodeList: TFPList);
|
||||||
function IndexOfCodeInUniqueList(ACode: Pointer;
|
function IndexOfCodeInUniqueList(ACode: Pointer;
|
||||||
UniqueSortedCodeList: TList): integer;
|
UniqueSortedCodeList: TList): integer;
|
||||||
@ -655,7 +638,7 @@ end;
|
|||||||
|
|
||||||
function dbgs(r: TLinkScannerRange): string; overload;
|
function dbgs(r: TLinkScannerRange): string; overload;
|
||||||
begin
|
begin
|
||||||
Result:=LinkScannerRangeNames[r];
|
str(r,Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure AddCodeToUniqueList(ACode: Pointer; UniqueSortedCodeList: TFPList);
|
procedure AddCodeToUniqueList(ACode: Pointer; UniqueSortedCodeList: TFPList);
|
||||||
|
@ -265,42 +265,9 @@ type
|
|||||||
procedure CalcMemSize(Stats: TCTMemStats); override;
|
procedure CalcMemSize(Stats: TCTMemStats); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
|
||||||
ProcHeadAttributeNames: array[TProcHeadAttribute] of string = (
|
|
||||||
// extract attributes:
|
|
||||||
'phpWithStart',
|
|
||||||
'phpWithoutClassKeyword',
|
|
||||||
'phpAddClassName',
|
|
||||||
'phpWithoutClassName',
|
|
||||||
'phpWithoutName',
|
|
||||||
'phpWithoutParamList',
|
|
||||||
'phpWithVarModifiers',
|
|
||||||
'phpWithParameterNames',
|
|
||||||
'phpWithoutParamTypes',
|
|
||||||
'phpWithHasDefaultValues',
|
|
||||||
'phpWithDefaultValues',
|
|
||||||
'phpWithResultType',
|
|
||||||
'phpWithOfObject',
|
|
||||||
'phpWithCallingSpecs',
|
|
||||||
'phpWithProcModifiers',
|
|
||||||
'phpWithComments',
|
|
||||||
'phpInUpperCase',
|
|
||||||
'phpCommentsToSpace',
|
|
||||||
'phpWithoutBrackets',
|
|
||||||
'phpWithoutSemicolon',
|
|
||||||
'phpDoNotAddSemicolon',
|
|
||||||
// search attributes:
|
|
||||||
'phpIgnoreForwards',
|
|
||||||
'phpIgnoreProcsWithBody',
|
|
||||||
'phpIgnoreMethods',
|
|
||||||
'phpOnlyWithClassname',
|
|
||||||
'phpFindCleanPosition',
|
|
||||||
// parse attributes:
|
|
||||||
'phpCreateNodes'
|
|
||||||
);
|
|
||||||
|
|
||||||
function ProcHeadAttributesToStr(Attr: TProcHeadAttributes): string;
|
function ProcHeadAttributesToStr(Attr: TProcHeadAttributes): string;
|
||||||
function dbgs(Attr: TProcHeadAttributes): string; overload;
|
function dbgs(Attr: TProcHeadAttributes): string; overload;
|
||||||
|
function dbgs(Attr: TProcHeadAttribute): string; overload;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -318,7 +285,7 @@ begin
|
|||||||
for a:=Low(TProcHeadAttribute) to High(TProcHeadAttribute) do begin
|
for a:=Low(TProcHeadAttribute) to High(TProcHeadAttribute) do begin
|
||||||
if a in Attr then begin
|
if a in Attr then begin
|
||||||
if Result<>'' then Result:=Result+',';
|
if Result<>'' then Result:=Result+',';
|
||||||
Result:=Result+ProcHeadAttributeNames[a];
|
Result:=Result+dbgs(a);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -328,6 +295,11 @@ begin
|
|||||||
Result:=ProcHeadAttributesToStr(Attr);
|
Result:=ProcHeadAttributesToStr(Attr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function dbgs(Attr: TProcHeadAttribute): string;
|
||||||
|
begin
|
||||||
|
str(Attr,Result);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TPascalParserTool }
|
{ TPascalParserTool }
|
||||||
|
|
||||||
constructor TPascalParserTool.Create;
|
constructor TPascalParserTool.Create;
|
||||||
|
@ -43,7 +43,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileProcs, CodeToolsStrConsts, CodeCache, BasicCodeTools,
|
Classes, SysUtils, FileProcs, CodeToolsStrConsts, CodeCache, BasicCodeTools,
|
||||||
typinfo, LinkScanner, AVL_Tree, CodeBeautifier, KeywordFuncLists;
|
LinkScanner, AVL_Tree, CodeBeautifier, KeywordFuncLists;
|
||||||
|
|
||||||
type
|
type
|
||||||
// Insert policy types for class parts (properties, variables, method defs)
|
// Insert policy types for class parts (properties, variables, method defs)
|
||||||
@ -394,7 +394,7 @@ end;
|
|||||||
|
|
||||||
function dbgs(g: TGapTyp): string;
|
function dbgs(g: TGapTyp): string;
|
||||||
begin
|
begin
|
||||||
Result:=GetEnumName(typeinfo(g),ord(g));
|
str(g,Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CompareSourceChangeCacheEntry(NodeData1, NodeData2: pointer): integer;
|
function CompareSourceChangeCacheEntry(NodeData1, NodeData2: pointer): integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user