mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-20 20:58:18 +02:00
* have the generic dummy symbols for procsyms keep track of their overloaded generic procsyms so that they can be easily found (will be needed for implicit specializations)
git-svn-id: trunk@48096 -
This commit is contained in:
parent
6d75992674
commit
6160abe37e
@ -1183,6 +1183,8 @@ implementation
|
|||||||
include(dummysym.symoptions,sp_generic_dummy);
|
include(dummysym.symoptions,sp_generic_dummy);
|
||||||
add_generic_dummysym(dummysym);
|
add_generic_dummysym(dummysym);
|
||||||
end;
|
end;
|
||||||
|
if dummysym.typ=procsym then
|
||||||
|
tprocsym(dummysym).add_generic_overload(aprocsym);
|
||||||
{ start token recorder for the declaration }
|
{ start token recorder for the declaration }
|
||||||
pd.init_genericdecl;
|
pd.init_genericdecl;
|
||||||
current_scanner.startrecordtokens(pd.genericdecltokenbuf);
|
current_scanner.startrecordtokens(pd.genericdecltokenbuf);
|
||||||
|
@ -48,7 +48,7 @@ const
|
|||||||
CurrentPPUVersion = 208;
|
CurrentPPUVersion = 208;
|
||||||
{ for any other changes to the ppu format, increase this version number
|
{ for any other changes to the ppu format, increase this version number
|
||||||
(it's a cardinal) }
|
(it's a cardinal) }
|
||||||
CurrentPPULongVersion = 12;
|
CurrentPPULongVersion = 13;
|
||||||
|
|
||||||
{ unit flags }
|
{ unit flags }
|
||||||
uf_big_endian = $000004;
|
uf_big_endian = $000004;
|
||||||
|
@ -131,6 +131,8 @@ interface
|
|||||||
protected
|
protected
|
||||||
FProcdefList : TFPObjectList;
|
FProcdefList : TFPObjectList;
|
||||||
FProcdefDerefList : TFPList;
|
FProcdefDerefList : TFPList;
|
||||||
|
fgenprocsymovlds : tfpobjectlist;
|
||||||
|
fgenprocsymovldsderefs : tfplist;
|
||||||
public
|
public
|
||||||
constructor create(const n : TSymStr);virtual;
|
constructor create(const n : TSymStr);virtual;
|
||||||
constructor ppuload(ppufile:tcompilerppufile);
|
constructor ppuload(ppufile:tcompilerppufile);
|
||||||
@ -153,7 +155,11 @@ interface
|
|||||||
function find_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
|
function find_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
|
||||||
function find_procdef_assignment_operator(fromdef,todef:tdef;var besteq:tequaltype;isexplicit:boolean):Tprocdef;
|
function find_procdef_assignment_operator(fromdef,todef:tdef;var besteq:tequaltype;isexplicit:boolean):Tprocdef;
|
||||||
function find_procdef_enumerator_operator(fromdef,todef:tdef;var besteq:tequaltype):Tprocdef;
|
function find_procdef_enumerator_operator(fromdef,todef:tdef;var besteq:tequaltype):Tprocdef;
|
||||||
|
procedure add_generic_overload(sym:tprocsym);
|
||||||
property ProcdefList:TFPObjectList read FProcdefList;
|
property ProcdefList:TFPObjectList read FProcdefList;
|
||||||
|
{ only valid if sp_generic_dummy is set and either an overload was
|
||||||
|
added using add_generic_overload or this was loaded from a ppu }
|
||||||
|
property genprocsymovlds:tfpobjectlist read fgenprocsymovlds;
|
||||||
end;
|
end;
|
||||||
tprocsymclass = class of tprocsym;
|
tprocsymclass = class of tprocsym;
|
||||||
|
|
||||||
@ -902,8 +908,10 @@ implementation
|
|||||||
|
|
||||||
constructor tprocsym.ppuload(ppufile:tcompilerppufile);
|
constructor tprocsym.ppuload(ppufile:tcompilerppufile);
|
||||||
var
|
var
|
||||||
|
symderef,
|
||||||
pdderef : tderef;
|
pdderef : tderef;
|
||||||
i,
|
i,
|
||||||
|
symcnt,
|
||||||
pdcnt : longint;
|
pdcnt : longint;
|
||||||
begin
|
begin
|
||||||
inherited ppuload(procsym,ppufile);
|
inherited ppuload(procsym,ppufile);
|
||||||
@ -915,6 +923,17 @@ implementation
|
|||||||
ppufile.getderef(pdderef);
|
ppufile.getderef(pdderef);
|
||||||
FProcdefDerefList.Add(Pointer(PtrInt(pdderef.dataidx)));
|
FProcdefDerefList.Add(Pointer(PtrInt(pdderef.dataidx)));
|
||||||
end;
|
end;
|
||||||
|
if sp_generic_dummy in symoptions then
|
||||||
|
begin
|
||||||
|
fgenprocsymovlds:=tfpobjectlist.create(false);
|
||||||
|
fgenprocsymovldsderefs:=tfplist.create;
|
||||||
|
symcnt:=ppufile.getword;
|
||||||
|
for i:=1 to symcnt do
|
||||||
|
begin
|
||||||
|
ppufile.getderef(symderef);
|
||||||
|
fgenprocsymovldsderefs.add(pointer(ptrint(symderef.dataidx)));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
ppuload_platform(ppufile);
|
ppuload_platform(ppufile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -924,6 +943,8 @@ implementation
|
|||||||
FProcdefList.Free;
|
FProcdefList.Free;
|
||||||
if assigned(FProcdefDerefList) then
|
if assigned(FProcdefDerefList) then
|
||||||
FProcdefDerefList.Free;
|
FProcdefDerefList.Free;
|
||||||
|
fgenprocsymovlds.free;
|
||||||
|
fgenprocsymovldsderefs.free;
|
||||||
inherited destroy;
|
inherited destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -942,6 +963,17 @@ implementation
|
|||||||
d.dataidx:=PtrInt(FProcdefDerefList[i]);
|
d.dataidx:=PtrInt(FProcdefDerefList[i]);
|
||||||
ppufile.putderef(d);
|
ppufile.putderef(d);
|
||||||
end;
|
end;
|
||||||
|
if sp_generic_dummy in symoptions then
|
||||||
|
begin
|
||||||
|
if not assigned(fgenprocsymovldsderefs) then
|
||||||
|
internalerror(2021010301);
|
||||||
|
ppufile.putword(fgenprocsymovldsderefs.count);
|
||||||
|
for i:=0 to fgenprocsymovldsderefs.count-1 do
|
||||||
|
begin
|
||||||
|
d.dataidx:=ptrint(fgenprocsymovldsderefs[i]);
|
||||||
|
ppufile.putderef(d);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
writeentry(ppufile,ibprocsym);
|
writeentry(ppufile,ibprocsym);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -996,6 +1028,7 @@ implementation
|
|||||||
i : longint;
|
i : longint;
|
||||||
pd : tprocdef;
|
pd : tprocdef;
|
||||||
d : tderef;
|
d : tderef;
|
||||||
|
sym : tprocsym;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
if not assigned(FProcdefDerefList) then
|
if not assigned(FProcdefDerefList) then
|
||||||
@ -1013,6 +1046,21 @@ implementation
|
|||||||
FProcdefDerefList.Add(Pointer(PtrInt(d.dataidx)));
|
FProcdefDerefList.Add(Pointer(PtrInt(d.dataidx)));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
if sp_generic_dummy in symoptions then
|
||||||
|
begin
|
||||||
|
if not assigned(fgenprocsymovlds) then
|
||||||
|
internalerror(2021010602);
|
||||||
|
if not assigned(fgenprocsymovldsderefs) then
|
||||||
|
fgenprocsymovldsderefs:=tfplist.create
|
||||||
|
else
|
||||||
|
fgenprocsymovldsderefs.clear;
|
||||||
|
for i:=0 to fgenprocsymovlds.count-1 do
|
||||||
|
begin
|
||||||
|
sym:=tprocsym(fgenprocsymovlds[i]);
|
||||||
|
d.build(sym);
|
||||||
|
fgenprocsymovldsderefs.add(pointer(ptrint(d.dataidx)));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1021,6 +1069,7 @@ implementation
|
|||||||
i : longint;
|
i : longint;
|
||||||
pd : tprocdef;
|
pd : tprocdef;
|
||||||
d : tderef;
|
d : tderef;
|
||||||
|
sym : tsym;
|
||||||
begin
|
begin
|
||||||
{ Clear all procdefs }
|
{ Clear all procdefs }
|
||||||
ProcdefList.Clear;
|
ProcdefList.Clear;
|
||||||
@ -1032,6 +1081,20 @@ implementation
|
|||||||
pd:=tprocdef(d.resolve);
|
pd:=tprocdef(d.resolve);
|
||||||
ProcdefList.Add(pd);
|
ProcdefList.Add(pd);
|
||||||
end;
|
end;
|
||||||
|
if sp_generic_dummy in symoptions then
|
||||||
|
begin
|
||||||
|
if not assigned(fgenprocsymovlds) then
|
||||||
|
internalerror(2021010603);
|
||||||
|
if not assigned(fgenprocsymovldsderefs) then
|
||||||
|
internalerror(2021010302);
|
||||||
|
fgenprocsymovlds.clear;
|
||||||
|
for i:= 0 to fgenprocsymovldsderefs.count-1 do
|
||||||
|
begin
|
||||||
|
d.dataidx:=ptrint(fgenprocsymovldsderefs[i]);
|
||||||
|
sym:=tprocsym(d.resolve);
|
||||||
|
fgenprocsymovlds.add(sym);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1398,6 +1461,21 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocsym.add_generic_overload(sym:tprocsym);
|
||||||
|
var
|
||||||
|
i : longint;
|
||||||
|
begin
|
||||||
|
if not (sp_generic_dummy in symoptions) then
|
||||||
|
internalerror(2021010601);
|
||||||
|
if not assigned(fgenprocsymovlds) then
|
||||||
|
fgenprocsymovlds:=tfpobjectlist.create(false);
|
||||||
|
for i:=0 to genprocsymovlds.count-1 do
|
||||||
|
if tprocsym(genprocsymovlds[i])=sym then
|
||||||
|
exit;
|
||||||
|
genprocsymovlds.add(sym);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
TERRORSYM
|
TERRORSYM
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
@ -1705,8 +1705,12 @@ begin
|
|||||||
if symoptions<>[] then
|
if symoptions<>[] then
|
||||||
begin
|
begin
|
||||||
if Def <> nil then
|
if Def <> nil then
|
||||||
if sp_internal in symoptions then
|
begin
|
||||||
Def.Visibility:=dvHidden;
|
if sp_internal in symoptions then
|
||||||
|
Def.Visibility:=dvHidden;
|
||||||
|
if sp_generic_dummy in symoptions then
|
||||||
|
Def.GenericDummy:=true;
|
||||||
|
end;
|
||||||
first:=true;
|
first:=true;
|
||||||
for i:=1to symopts do
|
for i:=1to symopts do
|
||||||
if (symopt[i].mask in symoptions) then
|
if (symopt[i].mask in symoptions) then
|
||||||
@ -3599,6 +3603,16 @@ begin
|
|||||||
readderef('', def.Ref);
|
readderef('', def.Ref);
|
||||||
_finddef(def);
|
_finddef(def);
|
||||||
end;
|
end;
|
||||||
|
if def.GenericDummy then
|
||||||
|
begin
|
||||||
|
len:=ppufile.getword;
|
||||||
|
for i:=1 to len do
|
||||||
|
begin
|
||||||
|
write([space,' Gen Ovld : ']);
|
||||||
|
readderef('',def.Ref);
|
||||||
|
_finddef(def);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ibconstsym :
|
ibconstsym :
|
||||||
|
@ -127,6 +127,7 @@ type
|
|||||||
// Symbol/definition reference
|
// Symbol/definition reference
|
||||||
Ref: TPpuRef;
|
Ref: TPpuRef;
|
||||||
Visibility: TPpuDefVisibility;
|
Visibility: TPpuDefVisibility;
|
||||||
|
GenericDummy: Boolean;
|
||||||
Attrs: array of TPpuAttr;
|
Attrs: array of TPpuAttr;
|
||||||
|
|
||||||
constructor Create(AParent: TPpuContainerDef); virtual; reintroduce;
|
constructor Create(AParent: TPpuContainerDef); virtual; reintroduce;
|
||||||
|
Loading…
Reference in New Issue
Block a user