mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 14:00:18 +02:00
codetools: set DirectoryCache of tool, removed auto fetching
git-svn-id: trunk@41552 -
This commit is contained in:
parent
324c59bc5d
commit
4ce8683fd7
@ -5564,6 +5564,9 @@ begin
|
|||||||
TCodeTool(Result).OnFindUsedUnit:=@DoOnFindUsedUnit;
|
TCodeTool(Result).OnFindUsedUnit:=@DoOnFindUsedUnit;
|
||||||
TCodeTool(Result).OnGetSrcPathForCompiledUnit:=@DoOnGetSrcPathForCompiledUnit;
|
TCodeTool(Result).OnGetSrcPathForCompiledUnit:=@DoOnGetSrcPathForCompiledUnit;
|
||||||
TCodeTool(Result).OnGetMethodName:=@DoOnInternalGetMethodName;
|
TCodeTool(Result).OnGetMethodName:=@DoOnInternalGetMethodName;
|
||||||
|
TCodeTool(Result).DirectoryCache:=
|
||||||
|
DirectoryCachePool.GetCache(ExtractFilePath(Code.Filename),
|
||||||
|
true,true);
|
||||||
Result.OnSetGlobalWriteLock:=@DoOnToolSetWriteLock;
|
Result.OnSetGlobalWriteLock:=@DoOnToolSetWriteLock;
|
||||||
Result.OnTreeChange:=@DoOnToolTreeChange;
|
Result.OnTreeChange:=@DoOnToolTreeChange;
|
||||||
TCodeTool(Result).OnParserProgress:=@DoOnParserProgress;
|
TCodeTool(Result).OnParserProgress:=@DoOnParserProgress;
|
||||||
|
@ -731,7 +731,6 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function CheckDirectoryCache: boolean;
|
|
||||||
procedure ConsistencyCheck; override;
|
procedure ConsistencyCheck; override;
|
||||||
procedure CalcMemSize(Stats: TCTMemStats); override;
|
procedure CalcMemSize(Stats: TCTMemStats); override;
|
||||||
|
|
||||||
@ -869,7 +868,7 @@ type
|
|||||||
write FOnGetMethodName;
|
write FOnGetMethodName;
|
||||||
property AdjustTopLineDueToComment: boolean
|
property AdjustTopLineDueToComment: boolean
|
||||||
read FAdjustTopLineDueToComment write FAdjustTopLineDueToComment;
|
read FAdjustTopLineDueToComment write FAdjustTopLineDueToComment;
|
||||||
property DirectoryCache: TCTDirectoryCache read FDirectoryCache;
|
property DirectoryCache: TCTDirectoryCache read FDirectoryCache write FDirectoryCache;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ExprTypeToString(const ExprType: TExpressionType): string;
|
function ExprTypeToString(const ExprType: TExpressionType): string;
|
||||||
@ -2179,8 +2178,7 @@ begin
|
|||||||
if (AnUnitName='') or (Scanner=nil) or (Scanner.MainCode=nil)
|
if (AnUnitName='') or (Scanner=nil) or (Scanner.MainCode=nil)
|
||||||
or (not (TObject(Scanner.MainCode) is TCodeBuffer))
|
or (not (TObject(Scanner.MainCode) is TCodeBuffer))
|
||||||
or (Scanner.OnLoadSource=nil)
|
or (Scanner.OnLoadSource=nil)
|
||||||
or (not CheckDirectoryCache) then
|
then begin
|
||||||
begin
|
|
||||||
RaiseException('TFindDeclarationTool.FindUnitSource Invalid Data');
|
RaiseException('TFindDeclarationTool.FindUnitSource Invalid Data');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2232,7 +2230,6 @@ end;
|
|||||||
function TFindDeclarationTool.FindUnitCaseInsensitive(var AnUnitName,
|
function TFindDeclarationTool.FindUnitCaseInsensitive(var AnUnitName,
|
||||||
AnUnitInFilename: string): string;
|
AnUnitInFilename: string): string;
|
||||||
begin
|
begin
|
||||||
if not CheckDirectoryCache then exit('');
|
|
||||||
Result:=DirectoryCache.FindUnitSourceInCompletePath(
|
Result:=DirectoryCache.FindUnitSourceInCompletePath(
|
||||||
AnUnitName,AnUnitInFilename,true);
|
AnUnitName,AnUnitInFilename,true);
|
||||||
end;
|
end;
|
||||||
@ -2242,7 +2239,6 @@ procedure TFindDeclarationTool.GatherUnitAndSrcPath(var UnitPath,
|
|||||||
begin
|
begin
|
||||||
UnitPath:='';
|
UnitPath:='';
|
||||||
CompleteSrcPath:='';
|
CompleteSrcPath:='';
|
||||||
if not CheckDirectoryCache then exit;
|
|
||||||
UnitPath:=DirectoryCache.Strings[ctdcsUnitPath];
|
UnitPath:=DirectoryCache.Strings[ctdcsUnitPath];
|
||||||
CompleteSrcPath:=DirectoryCache.Strings[ctdcsCompleteSrcPath];
|
CompleteSrcPath:=DirectoryCache.Strings[ctdcsCompleteSrcPath];
|
||||||
//DebugLn('TFindDeclarationTool.GatherUnitAndSrcPath UnitPath="',UnitPath,'" CompleteSrcPath="',CompleteSrcPath,'"');
|
//DebugLn('TFindDeclarationTool.GatherUnitAndSrcPath UnitPath="',UnitPath,'" CompleteSrcPath="',CompleteSrcPath,'"');
|
||||||
@ -2251,16 +2247,12 @@ end;
|
|||||||
function TFindDeclarationTool.SearchUnitInUnitLinks(const TheUnitName: string
|
function TFindDeclarationTool.SearchUnitInUnitLinks(const TheUnitName: string
|
||||||
): string;
|
): string;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
|
||||||
if not CheckDirectoryCache then exit;
|
|
||||||
Result:=DirectoryCache.FindUnitLink(TheUnitName);
|
Result:=DirectoryCache.FindUnitLink(TheUnitName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFindDeclarationTool.SearchUnitInUnitSet(const TheUnitName: string
|
function TFindDeclarationTool.SearchUnitInUnitSet(const TheUnitName: string
|
||||||
): string;
|
): string;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
|
||||||
if not CheckDirectoryCache then exit;
|
|
||||||
Result:=DirectoryCache.FindUnitInUnitSet(TheUnitName);
|
Result:=DirectoryCache.FindUnitInUnitSet(TheUnitName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -9425,14 +9417,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFindDeclarationTool.CheckDirectoryCache: boolean;
|
|
||||||
begin
|
|
||||||
if FDirectoryCache<>nil then exit(true);
|
|
||||||
if Assigned(OnGetDirectoryCache) then
|
|
||||||
FDirectoryCache:=OnGetDirectoryCache(ExtractFilePath(MainFilename));
|
|
||||||
Result:=FDirectoryCache<>nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TFindDeclarationTool.Create;
|
constructor TFindDeclarationTool.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
@ -1201,8 +1201,6 @@ function TStandardCodeTool.FixUsedUnitCaseInUsesSection(
|
|||||||
CurDir:=ExtractFilePath(TCodeBuffer(Scanner.MainCode).Filename);
|
CurDir:=ExtractFilePath(TCodeBuffer(Scanner.MainCode).Filename);
|
||||||
AFilename:=CurDir+AFilename;
|
AFilename:=CurDir+AFilename;
|
||||||
end;
|
end;
|
||||||
CheckDirectoryCache;
|
|
||||||
if DirectoryCache=nil then exit;
|
|
||||||
Result:=DirectoryCache.Pool.FindDiskFilename(AFilename,true);
|
Result:=DirectoryCache.Pool.FindDiskFilename(AFilename,true);
|
||||||
if Result='' then exit;
|
if Result='' then exit;
|
||||||
if MakeRelative then
|
if MakeRelative then
|
||||||
@ -1492,7 +1490,6 @@ const
|
|||||||
Node: TCodeTreeNode;
|
Node: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
if UsesNode=nil then exit(true);
|
if UsesNode=nil then exit(true);
|
||||||
if not CheckDirectoryCache then exit(false);
|
|
||||||
|
|
||||||
Node:=UsesNode.FirstChild;
|
Node:=UsesNode.FirstChild;
|
||||||
while Node<>nil do begin
|
while Node<>nil do begin
|
||||||
|
Loading…
Reference in New Issue
Block a user