* procsym.deref derefs only own procdefs

* reset paracount in procdef.deref so a second deref doesn't increase
    the paracounts to invalid values
This commit is contained in:
peter 2003-10-29 21:56:28 +00:00
parent 9c15bf7fb1
commit 75e5a6e867
2 changed files with 36 additions and 9 deletions

View File

@ -576,6 +576,7 @@ interface
tprocdeflist = record tprocdeflist = record
def : tprocdef; def : tprocdef;
defderef : tderef; defderef : tderef;
own : boolean;
next : pprocdeflist; next : pprocdeflist;
end; end;
@ -3345,6 +3346,8 @@ implementation
{ parast } { parast }
tparasymtable(parast).deref; tparasymtable(parast).deref;
{ paraitems } { paraitems }
minparacount:=0;
maxparacount:=0;
hp:=TParaItem(Para.first); hp:=TParaItem(Para.first);
while assigned(hp) do while assigned(hp) do
begin begin
@ -6104,7 +6107,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.185 2003-10-29 19:48:51 peter Revision 1.186 2003-10-29 21:56:28 peter
* procsym.deref derefs only own procdefs
* reset paracount in procdef.deref so a second deref doesn't increase
the paracounts to invalid values
Revision 1.185 2003/10/29 19:48:51 peter
* renamed mangeldname_prefix to make_mangledname and made it more * renamed mangeldname_prefix to make_mangledname and made it more
generic generic
* make_mangledname is now also used for internal threadvar/resstring * make_mangledname is now also used for internal threadvar/resstring

View File

@ -796,7 +796,7 @@ implementation
begin begin
{ only write the proc definitions that belong { only write the proc definitions that belong
to this procsym and are in the global symtable } to this procsym and are in the global symtable }
if (p^.def.procsym=self) and if p^.own and
(p^.def.owner.symtabletype in [globalsymtable,objectsymtable]) then (p^.def.owner.symtabletype in [globalsymtable,objectsymtable]) then
inc(n); inc(n);
p:=p^.next; p:=p^.next;
@ -808,7 +808,7 @@ implementation
begin begin
{ only write the proc definitions that belong { only write the proc definitions that belong
to this procsym and are in the global symtable } to this procsym and are in the global symtable }
if (p^.def.procsym=self) and if p^.own and
(p^.def.owner.symtabletype in [globalsymtable,objectsymtable]) then (p^.def.owner.symtabletype in [globalsymtable,objectsymtable]) then
ppufile.putderef(p^.defderef); ppufile.putderef(p^.defderef);
p:=p^.next; p:=p^.next;
@ -838,7 +838,7 @@ implementation
p:=pdlistfirst; p:=pdlistfirst;
while assigned(p) do while assigned(p) do
begin begin
if (p^.def.procsym=self) and if p^.own and
(p^.def.forwarddef) then (p^.def.forwarddef) then
begin begin
MessagePos1(p^.def.fileinfo,sym_e_forward_not_resolved,p^.def.fullprocname(false)); MessagePos1(p^.def.fileinfo,sym_e_forward_not_resolved,p^.def.fullprocname(false));
@ -857,7 +857,8 @@ implementation
p:=pdlistfirst; p:=pdlistfirst;
while assigned(p) do while assigned(p) do
begin begin
p^.defderef.build(p^.def); if p^.own then
p^.defderef.build(p^.def);
p:=p^.next; p:=p^.next;
end; end;
end; end;
@ -865,12 +866,22 @@ implementation
procedure tprocsym.deref; procedure tprocsym.deref;
var var
p : pprocdeflist; prev,hp,p : pprocdeflist;
begin begin
{ We have removed the overloaded entries, because they
are not valid anymore and we can't deref them because
the unit were they come from is not necessary in
our uses clause (PFV) }
unchain_overload;
{ Deref our own procdefs }
p:=pdlistfirst; p:=pdlistfirst;
prev:=nil;
while assigned(p) do while assigned(p) do
begin begin
if not p^.own then
internalerror(200310291);
p^.def:=tprocdef(p^.defderef.resolve); p^.def:=tprocdef(p^.defderef.resolve);
prev:=p;
p:=p^.next; p:=p^.next;
end; end;
end; end;
@ -884,6 +895,7 @@ implementation
pd^.def:=p; pd^.def:=p;
pd^.defderef.reset; pd^.defderef.reset;
pd^.next:=nil; pd^.next:=nil;
pd^.own:=(pd^.def.procsym=self);
{ Add at end of list to keep always { Add at end of list to keep always
a correct order, also after loading from ppu } a correct order, also after loading from ppu }
if assigned(pdlistlast) then if assigned(pdlistlast) then
@ -908,6 +920,7 @@ implementation
pd^.def:=nil; pd^.def:=nil;
pd^.defderef:=d; pd^.defderef:=d;
pd^.next:=nil; pd^.next:=nil;
pd^.own:=true;
{ Add at end of list to keep always { Add at end of list to keep always
a correct order, also after loading from ppu } a correct order, also after loading from ppu }
if assigned(pdlistlast) then if assigned(pdlistlast) then
@ -1253,7 +1266,7 @@ implementation
p:=pdlistfirst; p:=pdlistfirst;
while assigned(p) do while assigned(p) do
begin begin
if (p^.def.procsym=self) then if p^.own then
p^.def.write_references(ppufile,locals); p^.def.write_references(ppufile,locals);
p:=p^.next; p:=p^.next;
end; end;
@ -1266,6 +1279,7 @@ implementation
begin begin
{ remove all overloaded procdefs from the { remove all overloaded procdefs from the
procdeflist that are not in the current symtable } procdeflist that are not in the current symtable }
overloadchecked:=false;
p:=pdlistfirst; p:=pdlistfirst;
{ reset new lists } { reset new lists }
pdlistfirst:=nil; pdlistfirst:=nil;
@ -1273,7 +1287,7 @@ implementation
while assigned(p) do while assigned(p) do
begin begin
hp:=p^.next; hp:=p^.next;
if (p^.def.procsym=self) then if p^.own then
begin begin
{ keep, add to list } { keep, add to list }
if assigned(pdlistlast) then if assigned(pdlistlast) then
@ -2673,7 +2687,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.132 2003-10-29 19:48:51 peter Revision 1.133 2003-10-29 21:56:28 peter
* procsym.deref derefs only own procdefs
* reset paracount in procdef.deref so a second deref doesn't increase
the paracounts to invalid values
Revision 1.132 2003/10/29 19:48:51 peter
* renamed mangeldname_prefix to make_mangledname and made it more * renamed mangeldname_prefix to make_mangledname and made it more
generic generic
* make_mangledname is now also used for internal threadvar/resstring * make_mangledname is now also used for internal threadvar/resstring