mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 23:30:20 +02:00
compiler: fix property access from a nested routine of the static class method and extend a test
git-svn-id: trunk@25280 -
This commit is contained in:
parent
38058505ba
commit
4b76782691
@ -2671,12 +2671,10 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if (srsymtable.symtabletype in [ObjectSymtable,recordsymtable]) then
|
if (srsymtable.symtabletype in [ObjectSymtable,recordsymtable]) then
|
||||||
{ if we are accessing a owner procsym from the nested }
|
{ if we are accessing a owner procsym from the nested }
|
||||||
{ class we need to call it as a class member }
|
{ class or from a static class method we need to call }
|
||||||
if assigned(current_structdef) and (current_structdef<>hdef) and is_owned_by(current_structdef,hdef) then
|
{ it as a class member }
|
||||||
p1:=cloadvmtaddrnode.create(ctypenode.create(hdef))
|
if (assigned(current_structdef) and (current_structdef<>hdef) and is_owned_by(current_structdef,hdef)) or
|
||||||
else
|
(assigned(current_procinfo) and current_procinfo.get_normal_proc.procdef.no_self_node) then
|
||||||
if assigned(current_procinfo) and current_procinfo.procdef.no_self_node then
|
|
||||||
{ no self node in static class methods }
|
|
||||||
p1:=cloadvmtaddrnode.create(ctypenode.create(hdef))
|
p1:=cloadvmtaddrnode.create(ctypenode.create(hdef))
|
||||||
else
|
else
|
||||||
p1:=load_self_node;
|
p1:=load_self_node;
|
||||||
|
@ -5,8 +5,11 @@ program tw24865;
|
|||||||
|
|
||||||
type
|
type
|
||||||
TTest = class
|
TTest = class
|
||||||
|
public
|
||||||
|
class var fc3: integer;
|
||||||
class procedure c1();
|
class procedure c1();
|
||||||
class procedure c2(); static;
|
class procedure c2(); static;
|
||||||
|
class property c3: integer read fc3 write fc3;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TTest.c1;
|
class procedure TTest.c1;
|
||||||
@ -14,9 +17,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TTest.c2;
|
class procedure TTest.c2;
|
||||||
procedure nested;
|
|
||||||
|
function nested: integer;
|
||||||
begin
|
begin
|
||||||
c1;
|
c1;
|
||||||
|
fc3 := 1;
|
||||||
|
c3 := 2;
|
||||||
|
result := c3;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -24,4 +31,3 @@ end;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user