mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 17:09:10 +02:00
compiler: allow to skip the 'static' modifier in the method implementation + modified test
git-svn-id: trunk@14578 -
This commit is contained in:
parent
9cc211e88e
commit
58c71c3c59
@ -1053,7 +1053,7 @@ implementation
|
|||||||
consume(_PROCEDURE);
|
consume(_PROCEDURE);
|
||||||
if parse_proc_head(aclass,potype_procedure,pd) then
|
if parse_proc_head(aclass,potype_procedure,pd) then
|
||||||
begin
|
begin
|
||||||
{ pd=nil when it is a interface mapping }
|
{ pd=nil when it is an interface mapping }
|
||||||
if assigned(pd) then
|
if assigned(pd) then
|
||||||
begin
|
begin
|
||||||
pd.returndef:=voidtype;
|
pd.returndef:=voidtype;
|
||||||
@ -2694,6 +2694,7 @@ const
|
|||||||
po_comp : tprocoptions;
|
po_comp : tprocoptions;
|
||||||
paracompopt: tcompare_paras_options;
|
paracompopt: tcompare_paras_options;
|
||||||
forwardfound : boolean;
|
forwardfound : boolean;
|
||||||
|
symentry: TSymEntry;
|
||||||
begin
|
begin
|
||||||
forwardfound:=false;
|
forwardfound:=false;
|
||||||
|
|
||||||
@ -2767,6 +2768,22 @@ const
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Check static }
|
||||||
|
if (po_staticmethod in fwpd.procoptions) then
|
||||||
|
begin
|
||||||
|
if not (po_staticmethod in currpd.procoptions) then
|
||||||
|
begin
|
||||||
|
include(currpd.procoptions, po_staticmethod);
|
||||||
|
{ remove self from the hidden paras }
|
||||||
|
symentry:=currpd.parast.Find('self');
|
||||||
|
if symentry<>nil then
|
||||||
|
begin
|
||||||
|
currpd.parast.Delete(symentry);
|
||||||
|
currpd.calcparas;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Check if the procedure type and return type are correct,
|
{ Check if the procedure type and return type are correct,
|
||||||
also the parameters must match also with the type }
|
also the parameters must match also with the type }
|
||||||
if ((m_repeat_forward in current_settings.modeswitches) or
|
if ((m_repeat_forward in current_settings.modeswitches) or
|
||||||
|
@ -21,7 +21,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// for now fpc requires 'static' modifiers also in the class implementation
|
// for now fpc requires 'static' modifiers also in the class implementation
|
||||||
class procedure TSomeClass.SomeStaticMethod(A: Integer); {$ifdef fpc} static; {$endif}
|
class procedure TSomeClass.SomeStaticMethod(A: Integer);
|
||||||
begin
|
begin
|
||||||
WriteLn('TSomeClass.SomeStaticMethod: ', A);
|
WriteLn('TSomeClass.SomeStaticMethod: ', A);
|
||||||
WriteLn('TSomeClass.FSomethingStatic: ', FSomethingStatic);
|
WriteLn('TSomeClass.FSomethingStatic: ', FSomethingStatic);
|
||||||
|
Loading…
Reference in New Issue
Block a user