* Rename FindUnitWithName -> FindLoadedUnit

git-svn-id: trunk@40424 -
This commit is contained in:
michael 2018-12-01 08:54:34 +00:00
parent 77446cfe07
commit 4091e31c4f

View File

@ -539,7 +539,7 @@ type
procedure LoadPasFile(UnitFilename, UseUnitName: string; procedure LoadPasFile(UnitFilename, UseUnitName: string;
out aFile: TPas2jsCompilerFile out aFile: TPas2jsCompilerFile
{$IFDEF HasPas2jsFiler}; aFormat: TPas2JSPrecompileFormat = nil{$ENDIF}); {$IFDEF HasPas2jsFiler}; aFormat: TPas2JSPrecompileFormat = nil{$ENDIF});
function FindUnitWithName(const TheUnitName: string): TPas2jsCompilerFile; function FindLoadedUnit(const TheUnitName: string): TPas2jsCompilerFile;
procedure AddUsedUnit(aFile: TPas2jsCompilerFile); procedure AddUsedUnit(aFile: TPas2jsCompilerFile);
function ExpandFileName(const Filename: string): string; function ExpandFileName(const Filename: string): string;
@ -1778,7 +1778,7 @@ var
if FoundPasFilename='' then if FoundPasFilename='' then
begin begin
// search loaded units // search loaded units
aFile:=Compiler.FindUnitWithName(TestUnitName); aFile:=Compiler.FindLoadedUnit(TestUnitName);
if aFile<>nil then if aFile<>nil then
begin begin
FoundPasFilename:=aFile.PasFilename; FoundPasFilename:=aFile.PasFilename;
@ -1845,7 +1845,7 @@ begin
if InFilename='' then if InFilename='' then
begin begin
// search unitname in loaded units // search unitname in loaded units
aFile:=Compiler.FindUnitWithName(UseUnitname); aFile:=Compiler.FindLoadedUnit(UseUnitname);
if aFile<>nil then if aFile<>nil then
begin begin
FoundPasFilename:=aFile.PasFilename; FoundPasFilename:=aFile.PasFilename;
@ -1986,7 +1986,7 @@ begin
if InFilename<>'' then if InFilename<>'' then
begin begin
aFile:=Compiler.FindUnitWithName(UseUnitname); aFile:=Compiler.FindLoadedUnit(UseUnitname);
if aFile<>nil then if aFile<>nil then
begin begin
{$IF defined(VerbosePasResolver) or defined(VerbosePas2JS)} {$IF defined(VerbosePasResolver) or defined(VerbosePas2JS)}
@ -2031,7 +2031,7 @@ begin
// add file to trees // add file to trees
Compiler.AddUsedUnit(aFile); Compiler.AddUsedUnit(aFile);
// consistency checks // consistency checks
OtherFile:=Compiler.FindUnitWithName(UseUnitname); OtherFile:=Compiler.FindLoadedUnit(UseUnitname);
if aFile<>OtherFile then if aFile<>OtherFile then
begin begin
if OtherFile=nil then if OtherFile=nil then
@ -4211,7 +4211,6 @@ begin
FFileCache:=TPas2jsFilesCache.Create(Log); FFileCache:=TPas2jsFilesCache.Create(Log);
FFileCache.BaseDirectory:=GetCurrentDirPJ; FFileCache.BaseDirectory:=GetCurrentDirPJ;
FFileCacheAutoFree:=true; FFileCacheAutoFree:=true;
FDirectoryCache:=FFileCache.DirectoryCache;
FLog.OnFormatPath:=@FileCache.FormatPath; FLog.OnFormatPath:=@FileCache.FormatPath;
FPostProcs:=TObjectList.Create(true); FPostProcs:=TObjectList.Create(true);
@ -4265,7 +4264,6 @@ destructor TPas2jsCompiler.Destroy;
FreeAndNil(FFileCache) FreeAndNil(FFileCache)
else else
FFileCache:=nil; FFileCache:=nil;
FDirectoryCache:=nil;
FreeAndNil(FParamMacros); FreeAndNil(FParamMacros);
end; end;
@ -4951,7 +4949,7 @@ begin
end; end;
end; end;
function TPas2jsCompiler.FindUnitWithName(const TheUnitName: string function TPas2jsCompiler.FindLoadedUnit(const TheUnitName: string
): TPas2jsCompilerFile; ): TPas2jsCompilerFile;
begin begin
if not IsValidIdent(TheUnitName,true) then exit(nil); if not IsValidIdent(TheUnitName,true) then exit(nil);
@ -4964,7 +4962,7 @@ var
begin begin
if aFile.PasUnitName='' then if aFile.PasUnitName='' then
RaiseInternalError(20170504161347,'missing PasUnitName "'+aFile.PasFilename+'"'); RaiseInternalError(20170504161347,'missing PasUnitName "'+aFile.PasFilename+'"');
OldFile:=FindUnitWithName(aFile.PasUnitName); OldFile:=FindLoadedUnit(aFile.PasUnitName);
if OldFile<>nil then if OldFile<>nil then
begin begin
if OldFile<>aFile then if OldFile<>aFile then