codetools: clean up

git-svn-id: trunk@31210 -
This commit is contained in:
mattias 2011-06-14 10:24:55 +00:00
parent d5a9fc581d
commit faef63fad1
5 changed files with 28 additions and 89 deletions

View File

@ -54,7 +54,7 @@ interface
uses
Classes, SysUtils, BasicCodeTools, AVL_Tree, KeywordFuncLists, FileProcs,
typinfo, CodeToolsStrConsts;
CodeToolsStrConsts;
type
TCTCSValueType = (
@ -975,17 +975,17 @@ end;
function dbgs(const t: TCTCfgScriptStackItemType): string;
begin
Result:=GetEnumName(typeinfo(t),ord(t));
str(t,Result);
end;
function dbgs(const t: TCTCSValueType): string;
begin
Result:=GetEnumName(typeinfo(t),ord(t));
str(t,Result);
end;
function dbgs(const t: TCTCfgScriptOperator): string;
begin
Result:=GetEnumName(typeinfo(t),ord(t));
str(t,Result);
end;
function dbgs(const V: PCTCfgScriptVariable): string;

View File

@ -178,29 +178,6 @@ const
fdfDefaultForExpressions = [fdfSearchInParentNodes, fdfSearchInAncestors,
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
// flags/states for result
TFoundDeclarationFlag = (
@ -208,11 +185,6 @@ type
);
TFoundDeclarationFlags = set of TFoundDeclarationFlag;
const
FoundDeclarationFlagNames: array[TFoundDeclarationFlag] of string = (
'fodDoNotCache'
);
//----------------------------------------------------------------------------
type
TFindDeclarationParams = class;
@ -899,7 +871,9 @@ function dbgsFC(const Context: TFindContext): string;
function PredefinedIdentToExprTypeDesc(Identifier: PChar): TExpressionTypeDesc;
function dbgs(const Flags: TFindDeclarationFlags): string; overload;
function dbgs(const Flag: TFindDeclarationFlag): string; overload;
function dbgs(const Flags: TFoundDeclarationFlags): string; overload;
function dbgs(const Flag: TFoundDeclarationFlag): string; overload;
implementation
@ -914,11 +888,16 @@ begin
if Flag in Flags then begin
if Result<>'' then
Result:=Result+', ';
Result:=Result+FindDeclarationFlagNames[Flag];
Result:=Result+dbgs(Flag);
end;
end;
end;
function dbgs(const Flag: TFindDeclarationFlag): string;
begin
str(Flag,Result);
end;
function dbgs(
const Flags: TFoundDeclarationFlags): string;
var Flag: TFoundDeclarationFlag;
@ -928,11 +907,16 @@ begin
if Flag in Flags then begin
if Result<>'' then
Result:=Result+', ';
Result:=Result+FoundDeclarationFlagNames[Flag];
Result:=Result+dbgs(Flag);
end;
end;
end;
function dbgs(const Flag: TFoundDeclarationFlag): string;
begin
str(Flag,Result);
end;
function ListOfPFindContextToStr(const ListOfPFindContext: TFPList): string;
var
Context: TFindContext;

View File

@ -582,23 +582,6 @@ var
PSourceLinkMemManager: TPSourceLinkMemManager;
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);
function IndexOfCodeInUniqueList(ACode: Pointer;
UniqueSortedCodeList: TList): integer;
@ -655,7 +638,7 @@ end;
function dbgs(r: TLinkScannerRange): string; overload;
begin
Result:=LinkScannerRangeNames[r];
str(r,Result);
end;
procedure AddCodeToUniqueList(ACode: Pointer; UniqueSortedCodeList: TFPList);

View File

@ -265,42 +265,9 @@ type
procedure CalcMemSize(Stats: TCTMemStats); override;
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 dbgs(Attr: TProcHeadAttributes): string; overload;
function dbgs(Attr: TProcHeadAttribute): string; overload;
implementation
@ -318,7 +285,7 @@ begin
for a:=Low(TProcHeadAttribute) to High(TProcHeadAttribute) do begin
if a in Attr then begin
if Result<>'' then Result:=Result+',';
Result:=Result+ProcHeadAttributeNames[a];
Result:=Result+dbgs(a);
end;
end;
end;
@ -328,6 +295,11 @@ begin
Result:=ProcHeadAttributesToStr(Attr);
end;
function dbgs(Attr: TProcHeadAttribute): string;
begin
str(Attr,Result);
end;
{ TPascalParserTool }
constructor TPascalParserTool.Create;

View File

@ -43,7 +43,7 @@ interface
uses
Classes, SysUtils, FileProcs, CodeToolsStrConsts, CodeCache, BasicCodeTools,
typinfo, LinkScanner, AVL_Tree, CodeBeautifier, KeywordFuncLists;
LinkScanner, AVL_Tree, CodeBeautifier, KeywordFuncLists;
type
// Insert policy types for class parts (properties, variables, method defs)
@ -394,7 +394,7 @@ end;
function dbgs(g: TGapTyp): string;
begin
Result:=GetEnumName(typeinfo(g),ord(g));
str(g,Result);
end;
function CompareSourceChangeCacheEntry(NodeData1, NodeData2: pointer): integer;