mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 03:50:35 +02:00
* correctly update the (now unregistered) unit symbol if the unit was found with the help of a default namespace
(this is needed to trigger the correct creation of the namespace symbols) git-svn-id: trunk@38917 -
This commit is contained in:
parent
083781bf0c
commit
35bddf6fb1
@ -430,7 +430,7 @@ implementation
|
|||||||
var
|
var
|
||||||
s,sorg : ansistring;
|
s,sorg : ansistring;
|
||||||
fn : string;
|
fn : string;
|
||||||
pu : tused_unit;
|
pu,pu2 : tused_unit;
|
||||||
hp2 : tmodule;
|
hp2 : tmodule;
|
||||||
unitsym : tunitsym;
|
unitsym : tunitsym;
|
||||||
filepos : tfileposinfo;
|
filepos : tfileposinfo;
|
||||||
@ -487,8 +487,7 @@ implementation
|
|||||||
can not use the modulename because that can be different
|
can not use the modulename because that can be different
|
||||||
when -Un is used }
|
when -Un is used }
|
||||||
current_tokenpos:=filepos;
|
current_tokenpos:=filepos;
|
||||||
unitsym:=cunitsym.create(sorg,nil,true);
|
unitsym:=cunitsym.create(sorg,nil,false);
|
||||||
tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym);
|
|
||||||
{ the current module uses the unit hp2 }
|
{ the current module uses the unit hp2 }
|
||||||
current_module.addusedunit(hp2,true,unitsym);
|
current_module.addusedunit(hp2,true,unitsym);
|
||||||
end
|
end
|
||||||
@ -522,8 +521,40 @@ implementation
|
|||||||
pu.checksum:=pu.u.crc;
|
pu.checksum:=pu.u.crc;
|
||||||
pu.interface_checksum:=pu.u.interface_crc;
|
pu.interface_checksum:=pu.u.interface_crc;
|
||||||
pu.indirect_checksum:=pu.u.indirect_crc;
|
pu.indirect_checksum:=pu.u.indirect_crc;
|
||||||
|
if tppumodule(pu.u).nsprefix<>'' then
|
||||||
|
begin
|
||||||
|
{ use the name as declared in the uses section for -Un }
|
||||||
|
sorg:=tppumodule(pu.u).nsprefix+'.'+pu.unitsym.realname;
|
||||||
|
s:=upper(sorg);
|
||||||
|
{ check whether the module was already loaded }
|
||||||
|
hp2:=nil;
|
||||||
|
pu2:=tused_unit(current_module.used_units.first);
|
||||||
|
while assigned(pu2) and (pu2<>pu) do
|
||||||
|
begin
|
||||||
|
if (pu2.u.modulename^=s) then
|
||||||
|
begin
|
||||||
|
hp2:=pu.u;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
pu2:=tused_unit(pu2.next);
|
||||||
|
end;
|
||||||
|
if assigned(hp2) then
|
||||||
|
begin
|
||||||
|
MessagePos1(pu.unitsym.fileinfo,sym_e_duplicate_id,s);
|
||||||
|
pu:=tused_unit(pu.next);
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
|
{ update unitsym now that we have access to the full name }
|
||||||
|
pu.unitsym.free;
|
||||||
|
pu.unitsym:=cunitsym.create(sorg,pu.u,true);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
{ connect unitsym to the module }
|
{ connect unitsym to the module }
|
||||||
pu.unitsym.module:=pu.u;
|
pu.unitsym.module:=pu.u;
|
||||||
|
pu.unitsym.register_sym;
|
||||||
|
end;
|
||||||
|
tabstractunitsymtable(current_module.localsymtable).insertunit(pu.unitsym);
|
||||||
{ add to symtable stack }
|
{ add to symtable stack }
|
||||||
if assigned(preservest) then
|
if assigned(preservest) then
|
||||||
symtablestack.pushafter(pu.u.globalsymtable,preservest)
|
symtablestack.pushafter(pu.u.globalsymtable,preservest)
|
||||||
|
Loading…
Reference in New Issue
Block a user