mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 21:19:31 +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);
|
||||
if parse_proc_head(aclass,potype_procedure,pd) then
|
||||
begin
|
||||
{ pd=nil when it is a interface mapping }
|
||||
{ pd=nil when it is an interface mapping }
|
||||
if assigned(pd) then
|
||||
begin
|
||||
pd.returndef:=voidtype;
|
||||
@ -2694,6 +2694,7 @@ const
|
||||
po_comp : tprocoptions;
|
||||
paracompopt: tcompare_paras_options;
|
||||
forwardfound : boolean;
|
||||
symentry: TSymEntry;
|
||||
begin
|
||||
forwardfound:=false;
|
||||
|
||||
@ -2767,6 +2768,22 @@ const
|
||||
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,
|
||||
also the parameters must match also with the type }
|
||||
if ((m_repeat_forward in current_settings.modeswitches) or
|
||||
|
@ -21,7 +21,7 @@ begin
|
||||
end;
|
||||
|
||||
// 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
|
||||
WriteLn('TSomeClass.SomeStaticMethod: ', A);
|
||||
WriteLn('TSomeClass.FSomethingStatic: ', FSomethingStatic);
|
||||
|
Loading…
Reference in New Issue
Block a user