* fixed getcopy order for ttempcreatenode in case it has tempinitcode

(this tempinitcode contains a reference to the tempcreatenode itself
     -> hookoncopy must be set before copying the tempinitnode)

git-svn-id: trunk@18016 -
This commit is contained in:
Jonas Maebe 2011-07-18 00:38:47 +00:00
parent 95ad75c7bf
commit cb1da8de85

View File

@ -747,6 +747,17 @@ implementation
n.tempinfo^.typedef := tempinfo^.typedef;
n.tempinfo^.temptype := tempinfo^.temptype;
n.tempinfo^.flags := tempinfo^.flags * tempinfostoreflags;
{ when the tempinfo has already a hookoncopy then it is not
reset by a tempdeletenode }
if assigned(tempinfo^.hookoncopy) then
internalerror(200211262);
{ signal the temprefs that the temp they point to has been copied, }
{ so that if the refs get copied as well, they can hook themselves }
{ to the copy of the temp }
tempinfo^.hookoncopy := n.tempinfo;
exclude(tempinfo^.flags,ti_nextref_set_hookoncopy_nil);
if assigned(tempinfo^.withnode) then
n.tempinfo^.withnode := tempinfo^.withnode.getcopy
else
@ -757,17 +768,6 @@ implementation
else
n.tempinfo^.tempinitcode := nil;
{ when the tempinfo has already a hookoncopy then it is not
reset by a tempdeletenode }
if assigned(tempinfo^.hookoncopy) then
internalerror(200211262);
{ signal the temprefs that the temp they point to has been copied, }
{ so that if the refs get copied as well, they can hook themselves }
{ to the copy of the temp }
tempinfo^.hookoncopy := n.tempinfo;
exclude(tempinfo^.flags,ti_nextref_set_hookoncopy_nil);
result := n;
end;