mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 08:59:27 +02:00
+ patch to support assigning class procedures to procedure variables by Ondrej Pokorny, resolves #30936
+ additional tests git-svn-id: trunk@34909 -
This commit is contained in:
parent
4ddbb7cd26
commit
67570a6262
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -15255,6 +15255,10 @@ tests/webtbs/tw3083.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30889.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw30923.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3093.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30936.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw30936a.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw30936b.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw30936c.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3101.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3104.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3109.pp svneol=native#text/plain
|
||||
|
@ -6408,7 +6408,7 @@ implementation
|
||||
|
||||
function tprocvardef.is_addressonly:boolean;
|
||||
begin
|
||||
result:=(not(po_methodpointer in procoptions) and
|
||||
result:=((not(po_methodpointer in procoptions) or (po_staticmethod in procoptions)) and
|
||||
not(po_is_block in procoptions) and
|
||||
not is_nested_pd(self)) or
|
||||
(po_addressonly in procoptions);
|
||||
|
33
tests/webtbs/tw30936.pp
Normal file
33
tests/webtbs/tw30936.pp
Normal file
@ -0,0 +1,33 @@
|
||||
program StaticClassProc;
|
||||
|
||||
{$MODE OBJFPC}
|
||||
|
||||
type
|
||||
TTest = class
|
||||
public type
|
||||
TProcedure = procedure;
|
||||
private
|
||||
class procedure MyProc; static;
|
||||
public
|
||||
constructor Create;
|
||||
end;
|
||||
|
||||
{ TTest }
|
||||
|
||||
constructor TTest.Create;
|
||||
var
|
||||
aProc: TProcedure;
|
||||
begin
|
||||
aProc := @MyProc;
|
||||
aProc;
|
||||
end;
|
||||
|
||||
class procedure TTest.MyProc;
|
||||
begin
|
||||
Writeln('OK');
|
||||
end;
|
||||
|
||||
begin
|
||||
TTest.Create;
|
||||
end.
|
||||
|
33
tests/webtbs/tw30936a.pp
Normal file
33
tests/webtbs/tw30936a.pp
Normal file
@ -0,0 +1,33 @@
|
||||
program StaticClassProc;
|
||||
|
||||
{$MODE DELPHI}
|
||||
|
||||
type
|
||||
TTest = class
|
||||
public type
|
||||
TProcedure = procedure;
|
||||
private
|
||||
class procedure MyProc; static;
|
||||
public
|
||||
constructor Create;
|
||||
end;
|
||||
|
||||
{ TTest }
|
||||
|
||||
constructor TTest.Create;
|
||||
var
|
||||
aProc: TProcedure;
|
||||
begin
|
||||
aProc := MyProc;
|
||||
aProc;
|
||||
end;
|
||||
|
||||
class procedure TTest.MyProc;
|
||||
begin
|
||||
Writeln('OK');
|
||||
end;
|
||||
|
||||
begin
|
||||
TTest.Create;
|
||||
end.
|
||||
|
32
tests/webtbs/tw30936b.pp
Normal file
32
tests/webtbs/tw30936b.pp
Normal file
@ -0,0 +1,32 @@
|
||||
program StaticClassProc;
|
||||
|
||||
{$MODE OBJFPC}
|
||||
|
||||
type
|
||||
TTest = class
|
||||
public type
|
||||
TProcedure = procedure;
|
||||
private
|
||||
class procedure MyProc; static;
|
||||
public
|
||||
constructor Create;
|
||||
end;
|
||||
|
||||
{ TTest }
|
||||
|
||||
constructor TTest.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TTest.MyProc;
|
||||
begin
|
||||
Writeln('OK');
|
||||
end;
|
||||
|
||||
var
|
||||
aProc: TProcedure;
|
||||
begin
|
||||
aProc := @TTest.MyProc;
|
||||
aProc;
|
||||
end.
|
||||
|
32
tests/webtbs/tw30936c.pp
Normal file
32
tests/webtbs/tw30936c.pp
Normal file
@ -0,0 +1,32 @@
|
||||
program StaticClassProc;
|
||||
|
||||
{$MODE DELPHI}
|
||||
|
||||
type
|
||||
TTest = class
|
||||
public type
|
||||
TProcedure = procedure;
|
||||
private
|
||||
class procedure MyProc; static;
|
||||
public
|
||||
constructor Create;
|
||||
end;
|
||||
|
||||
{ TTest }
|
||||
|
||||
constructor TTest.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TTest.MyProc;
|
||||
begin
|
||||
Writeln('OK');
|
||||
end;
|
||||
|
||||
var
|
||||
aProc: TProcedure;
|
||||
begin
|
||||
aProc := TTest.MyProc;
|
||||
aProc;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user