mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 21:49:06 +02:00
* Applied patch from Graeme to fix link resolving (17276)
git-svn-id: trunk@15910 -
This commit is contained in:
parent
c3095bf873
commit
bd7d55d592
@ -1071,8 +1071,17 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
ThisPackage: TLinkNode;
|
ThisPackage: TLinkNode;
|
||||||
UnitList: TList;
|
UnitList: TList;
|
||||||
|
|
||||||
|
function CanWeExit(AResult: string): boolean;
|
||||||
|
var
|
||||||
|
s: string;
|
||||||
|
begin
|
||||||
|
s := StringReplace(Lowercase(ALinkDest), '.', '_', [rfReplaceAll]);
|
||||||
|
Result := pos(s, AResult) > 0;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
//WriteLn('ResolveLink(', ALinkDest, ')... ');
|
//system.WriteLn('ResolveLink(', AModule.Name, ' - ', ALinkDest, ')... ');
|
||||||
if Length(ALinkDest) = 0 then
|
if Length(ALinkDest) = 0 then
|
||||||
begin
|
begin
|
||||||
SetLength(Result, 0);
|
SetLength(Result, 0);
|
||||||
@ -1083,13 +1092,18 @@ begin
|
|||||||
Result := FindAbsoluteLink(ALinkDest)
|
Result := FindAbsoluteLink(ALinkDest)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result := ResolveLink(AModule, amodule.packagename + '.' + ALinkDest);
|
if Pos(AModule.Name, ALinkDest) = 1 then
|
||||||
if Length(Result) > 0 then
|
begin
|
||||||
exit;
|
Result := ResolveLink(AModule, amodule.packagename + '.' + ALinkDest);
|
||||||
|
if CanWeExit(Result) then
|
||||||
Result := ResolveLink(AModule, AModule.PathName + '.' + ALinkDest);
|
Exit;
|
||||||
if Length(Result) > 0 then
|
end
|
||||||
exit;
|
else
|
||||||
|
begin
|
||||||
|
Result := ResolveLink(AModule, AModule.PathName + '.' + ALinkDest);
|
||||||
|
if CanWeExit(Result) then
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Try all packages }
|
{ Try all packages }
|
||||||
SetLength(Result, 0);
|
SetLength(Result, 0);
|
||||||
@ -1097,12 +1111,12 @@ begin
|
|||||||
while Assigned(ThisPackage) do
|
while Assigned(ThisPackage) do
|
||||||
begin
|
begin
|
||||||
Result := ResolveLink(AModule, ThisPackage.Name + '.' + ALinkDest);
|
Result := ResolveLink(AModule, ThisPackage.Name + '.' + ALinkDest);
|
||||||
if Length(Result) > 0 then
|
if CanWeExit(Result) then
|
||||||
exit;
|
Exit;
|
||||||
ThisPackage := ThisPackage.NextSibling;
|
ThisPackage := ThisPackage.NextSibling;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Length(Result) = 0 then
|
if not CanWeExit(Result) then
|
||||||
begin
|
begin
|
||||||
{ Okay, then we have to try all imported units of the current module }
|
{ Okay, then we have to try all imported units of the current module }
|
||||||
UnitList := AModule.InterfaceSection.UsesList;
|
UnitList := AModule.InterfaceSection.UsesList;
|
||||||
@ -1114,8 +1128,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
Result := ResolveLink(AModule, ThisPackage.Name + '.' +
|
Result := ResolveLink(AModule, ThisPackage.Name + '.' +
|
||||||
TPasType(UnitList[i]).Name + '.' + ALinkDest);
|
TPasType(UnitList[i]).Name + '.' + ALinkDest);
|
||||||
if Length(Result) > 0 then
|
if CanWeExit(Result) then
|
||||||
exit;
|
Exit;
|
||||||
ThisPackage := ThisPackage.NextSibling;
|
ThisPackage := ThisPackage.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="7"/>
|
<Version Value="9"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<SaveClosedFiles Value="False"/>
|
<SaveClosedFiles Value="False"/>
|
||||||
@ -13,10 +13,9 @@
|
|||||||
</Flags>
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<TargetFileExt Value=""/>
|
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<StringTable ProductVersion=""/>
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
@ -62,34 +61,35 @@
|
|||||||
<UnitName Value="dw_HTML"/>
|
<UnitName Value="dw_HTML"/>
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="dw_ipf.pp"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
<UnitName Value="dw_IPF"/>
|
|
||||||
</Unit6>
|
|
||||||
<Unit7>
|
|
||||||
<Filename Value="dw_man.pp"/>
|
<Filename Value="dw_man.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="dw_man"/>
|
<UnitName Value="dw_man"/>
|
||||||
</Unit7>
|
</Unit6>
|
||||||
<Unit8>
|
<Unit7>
|
||||||
<Filename Value="dw_linrtf.pp"/>
|
<Filename Value="dw_linrtf.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="dw_LinRTF"/>
|
<UnitName Value="dw_LinRTF"/>
|
||||||
</Unit8>
|
</Unit7>
|
||||||
<Unit9>
|
<Unit8>
|
||||||
<Filename Value="dw_txt.pp"/>
|
<Filename Value="dw_txt.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="dw_txt"/>
|
<UnitName Value="dw_txt"/>
|
||||||
</Unit9>
|
</Unit8>
|
||||||
<Unit10>
|
<Unit9>
|
||||||
<Filename Value="dglobals.pp"/>
|
<Filename Value="dglobals.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="dGlobals"/>
|
<UnitName Value="dGlobals"/>
|
||||||
|
</Unit9>
|
||||||
|
<Unit10>
|
||||||
|
<Filename Value="dw_ipflin.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="dw_ipflin"/>
|
||||||
</Unit10>
|
</Unit10>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="9"/>
|
||||||
|
</Parsing>
|
||||||
<Other>
|
<Other>
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
</Other>
|
</Other>
|
||||||
|
Loading…
Reference in New Issue
Block a user