mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 10:49:17 +02:00
* duplicate procsym-unitsym fix
This commit is contained in:
parent
78213ee091
commit
9147303907
@ -409,6 +409,7 @@ implementation
|
||||
st : tsymtable;
|
||||
srsymtable : tsymtable;
|
||||
storepos,procstartfilepos : tfileposinfo;
|
||||
searchagain : boolean;
|
||||
i: longint;
|
||||
begin
|
||||
{ Save the position where this procedure really starts }
|
||||
@ -521,6 +522,8 @@ implementation
|
||||
(options in [potype_constructor,potype_destructor]) then
|
||||
Message(parser_e_constructors_always_objects);
|
||||
|
||||
repeat
|
||||
searchagain:=false;
|
||||
akttokenpos:=procstartfilepos;
|
||||
aktprocsym:=tprocsym(symtablestack.search(sp));
|
||||
|
||||
@ -544,16 +547,27 @@ implementation
|
||||
begin
|
||||
{Check if it is a procedure.}
|
||||
if aktprocsym.typ<>procsym then
|
||||
begin
|
||||
{ when the other symbol is a unit symbol then hide the unit
|
||||
symbol. Only in tp mode because it's bad programming }
|
||||
if (m_duplicate_names in aktmodeswitches) and
|
||||
(aktprocsym.typ=unitsym) then
|
||||
begin
|
||||
aktprocsym.owner.rename(aktprocsym.name,'hidden'+aktprocsym.name);
|
||||
searchagain:=true;
|
||||
end
|
||||
else
|
||||
DuplicateSym(aktprocsym);
|
||||
end;
|
||||
{The procedure has been found. So it is
|
||||
a global one. Set the flags to mark this.}
|
||||
procinfo.flags:=procinfo.flags or pi_is_global;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if assigned(aktprocsym) then
|
||||
if (not searchagain) and
|
||||
assigned(aktprocsym) then
|
||||
begin
|
||||
{ Check if overloaded is a procsym }
|
||||
if aktprocsym.typ<>procsym then
|
||||
@ -564,6 +578,7 @@ implementation
|
||||
(aktprocsym.typ=unitsym) then
|
||||
begin
|
||||
aktprocsym.owner.rename(aktprocsym.name,'hidden'+aktprocsym.name);
|
||||
searchagain:=true;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -580,6 +595,8 @@ implementation
|
||||
aktprocsym:=nil;
|
||||
end;
|
||||
end;
|
||||
until not searchagain;
|
||||
end;
|
||||
|
||||
{ test again if assigned, it can be reset to recover }
|
||||
if not assigned(aktprocsym) then
|
||||
@ -2079,7 +2096,10 @@ const
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.93 2002-12-24 21:21:06 peter
|
||||
Revision 1.94 2002-12-25 01:26:56 peter
|
||||
* duplicate procsym-unitsym fix
|
||||
|
||||
Revision 1.93 2002/12/24 21:21:06 peter
|
||||
* remove code that skipped the _ prefix for win32 imports
|
||||
|
||||
Revision 1.92 2002/12/23 21:24:22 peter
|
||||
|
@ -657,6 +657,8 @@ implementation
|
||||
begin
|
||||
Message1(parser_p_procedure_start,
|
||||
aktprocdef.fullprocname);
|
||||
|
||||
if assigned(aktprocsym.owner) then
|
||||
aktprocdef.aliasnames.insert(aktprocdef.mangledname);
|
||||
{ set _FAIL as keyword if constructor }
|
||||
if (aktprocdef.proctypeoption=potype_constructor) then
|
||||
@ -687,6 +689,12 @@ implementation
|
||||
prevdef.nextoverloaded:=stdef;
|
||||
end;
|
||||
{$endif notused}
|
||||
{ release procsym when it was not stored in the symtable }
|
||||
if not assigned(aktprocsym.owner) then
|
||||
begin
|
||||
aktprocsym.free;
|
||||
aktprocdef.procsym:=nil;
|
||||
end;
|
||||
aktprocsym:=oldprocsym;
|
||||
aktprocdef:=oldprocdef;
|
||||
procinfo:=oldprocinfo;
|
||||
@ -810,7 +818,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.81 2002-12-15 13:37:15 peter
|
||||
Revision 1.82 2002-12-25 01:26:56 peter
|
||||
* duplicate procsym-unitsym fix
|
||||
|
||||
Revision 1.81 2002/12/15 13:37:15 peter
|
||||
* don't include uf_init for library. The code is already called and
|
||||
does not need to be in the initfinal table
|
||||
|
||||
|
@ -1662,11 +1662,20 @@ implementation
|
||||
begin
|
||||
hsym:=tsym(next.search(sym.name));
|
||||
if assigned(hsym) then
|
||||
begin
|
||||
{ Delphi you can have a symbol with the same name as the
|
||||
unit, the unit can then not be accessed anymore using
|
||||
<unit>.<id>, so we can hide the symbol }
|
||||
if (m_duplicate_names in aktmodeswitches) and
|
||||
(hsym.typ=symconst.unitsym) then
|
||||
hsym.owner.rename(hsym.name,'hidden'+hsym.name)
|
||||
else
|
||||
begin
|
||||
DuplicateSym(hsym);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
inherited insert(sym);
|
||||
end;
|
||||
@ -1820,11 +1829,20 @@ implementation
|
||||
begin
|
||||
hsym:=tsym(next.search(sym.name));
|
||||
if assigned(hsym) then
|
||||
begin
|
||||
{ Delphi you can have a symbol with the same name as the
|
||||
unit, the unit can then not be accessed anymore using
|
||||
<unit>.<id>, so we can hide the symbol }
|
||||
if (m_duplicate_names in aktmodeswitches) and
|
||||
(hsym.typ=symconst.unitsym) then
|
||||
hsym.owner.rename(hsym.name,'hidden'+hsym.name)
|
||||
else
|
||||
begin
|
||||
DuplicateSym(hsym);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
hsym:=tsym(search(sym.name));
|
||||
if assigned(hsym) then
|
||||
@ -2341,7 +2359,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.86 2002-12-21 13:07:34 peter
|
||||
Revision 1.87 2002-12-25 01:26:56 peter
|
||||
* duplicate procsym-unitsym fix
|
||||
|
||||
Revision 1.86 2002/12/21 13:07:34 peter
|
||||
* type redefine fix for tb0437
|
||||
|
||||
Revision 1.85 2002/12/07 14:27:10 carl
|
||||
|
Loading…
Reference in New Issue
Block a user