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