mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 19:20:46 +01:00
* Fixed the parentfp optimization for some cases when nested procvars are used.
git-svn-id: trunk@45664 -
This commit is contained in:
parent
cc23515927
commit
c15b6f4516
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15228,6 +15228,7 @@ tests/test/tmt1.pp svneol=native#text/plain
|
|||||||
tests/test/tmul1.pp svneol=native#text/pascal
|
tests/test/tmul1.pp svneol=native#text/pascal
|
||||||
tests/test/tnest1.pp svneol=native#text/plain
|
tests/test/tnest1.pp svneol=native#text/plain
|
||||||
tests/test/tnest2.pp svneol=native#text/plain
|
tests/test/tnest2.pp svneol=native#text/plain
|
||||||
|
tests/test/tnest3.pp svneol=native#text/plain
|
||||||
tests/test/tnoext1.pp svneol=native#text/plain
|
tests/test/tnoext1.pp svneol=native#text/plain
|
||||||
tests/test/tnoext2.pp svneol=native#text/plain
|
tests/test/tnoext2.pp svneol=native#text/plain
|
||||||
tests/test/tnoext3.pp svneol=native#text/plain
|
tests/test/tnoext3.pp svneol=native#text/plain
|
||||||
|
|||||||
@ -389,6 +389,9 @@ implementation
|
|||||||
that the address needs to be returned }
|
that the address needs to be returned }
|
||||||
resultdef:=fprocdef;
|
resultdef:=fprocdef;
|
||||||
|
|
||||||
|
if is_nested_pd(fprocdef) and is_nested_pd(current_procinfo.procdef) then
|
||||||
|
current_procinfo.set_needs_parentfp(tprocdef(fprocdef.owner.defowner).parast.symtablelevel);
|
||||||
|
|
||||||
{ process methodpointer/framepointer }
|
{ process methodpointer/framepointer }
|
||||||
if assigned(left) then
|
if assigned(left) then
|
||||||
begin
|
begin
|
||||||
|
|||||||
33
tests/test/tnest3.pp
Normal file
33
tests/test/tnest3.pp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{$mode objfpc}
|
||||||
|
{$modeswitch nestedprocvars}
|
||||||
|
|
||||||
|
type
|
||||||
|
tnestedfunc = function (i: longint): longint is nested;
|
||||||
|
|
||||||
|
function test: longint;
|
||||||
|
var
|
||||||
|
i: longint;
|
||||||
|
|
||||||
|
function func3(aa: longint): longint;
|
||||||
|
begin
|
||||||
|
result:=i+aa;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function func(aa: integer): integer;
|
||||||
|
var
|
||||||
|
nf: tnestedfunc;
|
||||||
|
begin
|
||||||
|
nf:=@func3;
|
||||||
|
result:=nf(aa);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
i:=100;
|
||||||
|
result:=func(10);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if test <> 110 then
|
||||||
|
halt(1);
|
||||||
|
writeln('OK');
|
||||||
|
end.
|
||||||
Loading…
Reference in New Issue
Block a user