* Applied patch from Graeme to fix link resolving (17276)

git-svn-id: trunk@15910 -
This commit is contained in:
michael 2010-08-26 14:40:20 +00:00
parent c3095bf873
commit bd7d55d592
2 changed files with 42 additions and 28 deletions

View File

@ -1071,8 +1071,17 @@ var
i: Integer;
ThisPackage: TLinkNode;
UnitList: TList;
function CanWeExit(AResult: string): boolean;
var
s: string;
begin
s := StringReplace(Lowercase(ALinkDest), '.', '_', [rfReplaceAll]);
Result := pos(s, AResult) > 0;
end;
begin
//WriteLn('ResolveLink(', ALinkDest, ')... ');
//system.WriteLn('ResolveLink(', AModule.Name, ' - ', ALinkDest, ')... ');
if Length(ALinkDest) = 0 then
begin
SetLength(Result, 0);
@ -1083,13 +1092,18 @@ begin
Result := FindAbsoluteLink(ALinkDest)
else
begin
Result := ResolveLink(AModule, amodule.packagename + '.' + ALinkDest);
if Length(Result) > 0 then
exit;
Result := ResolveLink(AModule, AModule.PathName + '.' + ALinkDest);
if Length(Result) > 0 then
exit;
if Pos(AModule.Name, ALinkDest) = 1 then
begin
Result := ResolveLink(AModule, amodule.packagename + '.' + ALinkDest);
if CanWeExit(Result) then
Exit;
end
else
begin
Result := ResolveLink(AModule, AModule.PathName + '.' + ALinkDest);
if CanWeExit(Result) then
Exit;
end;
{ Try all packages }
SetLength(Result, 0);
@ -1097,12 +1111,12 @@ begin
while Assigned(ThisPackage) do
begin
Result := ResolveLink(AModule, ThisPackage.Name + '.' + ALinkDest);
if Length(Result) > 0 then
exit;
if CanWeExit(Result) then
Exit;
ThisPackage := ThisPackage.NextSibling;
end;
if Length(Result) = 0 then
if not CanWeExit(Result) then
begin
{ Okay, then we have to try all imported units of the current module }
UnitList := AModule.InterfaceSection.UsesList;
@ -1114,8 +1128,8 @@ begin
begin
Result := ResolveLink(AModule, ThisPackage.Name + '.' +
TPasType(UnitList[i]).Name + '.' + ALinkDest);
if Length(Result) > 0 then
exit;
if CanWeExit(Result) then
Exit;
ThisPackage := ThisPackage.NextSibling;
end;
end;

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<Version Value="9"/>
<General>
<Flags>
<SaveClosedFiles Value="False"/>
@ -13,10 +13,9 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<StringTable ProductVersion=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
@ -62,34 +61,35 @@
<UnitName Value="dw_HTML"/>
</Unit5>
<Unit6>
<Filename Value="dw_ipf.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_IPF"/>
</Unit6>
<Unit7>
<Filename Value="dw_man.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_man"/>
</Unit7>
<Unit8>
</Unit6>
<Unit7>
<Filename Value="dw_linrtf.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_LinRTF"/>
</Unit8>
<Unit9>
</Unit7>
<Unit8>
<Filename Value="dw_txt.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_txt"/>
</Unit9>
<Unit10>
</Unit8>
<Unit9>
<Filename Value="dglobals.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dGlobals"/>
</Unit9>
<Unit10>
<Filename Value="dw_ipflin.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_ipflin"/>
</Unit10>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Version Value="9"/>
</Parsing>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>