* Enable function references and anonymous functions in Delphi mode

This commit is contained in:
Michaël Van Canneyt 2023-10-31 08:41:58 +01:00
parent b3d3b65bdf
commit 9f3a50315b
3 changed files with 56 additions and 1 deletions

View File

@ -55,7 +55,8 @@ interface
m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
m_out,m_default_para,m_duplicate_names,m_hintdirective,
m_property,m_default_inline,m_except,m_advanced_records,
m_array_operators,m_prefixed_attributes,m_underscoreisseparator];
m_array_operators,m_prefixed_attributes,m_underscoreisseparator,
m_function_references,m_anonymous_functions];
delphiunicodemodeswitches = delphimodeswitches + [m_systemcodepage,m_default_unicodestring];
fpcmodeswitches =
[m_fpc,m_string_pchar,m_nested_comment,m_repeat_forward,

29
tests/test/tfuncref52.pp Normal file
View File

@ -0,0 +1,29 @@
// Test to determine that function references are enabled in mode delphi
{$mode delphi}
{ $modeswitch functionreferences}
{%NORUN}
program tfuncref52;
Type
TProc = Reference to Procedure;
var
P : TProc;
Procedure Testit;
Procedure SoSo;
begin
end;
begin
P:=SoSo;
P;
end;
begin
Testit;
end.

25
tests/test/tfuncref53.pp Normal file
View File

@ -0,0 +1,25 @@
// Test to determine that anonymus functions are enabled in mode delphi
{$mode delphi}
{%NORUN}
program tfuncref52;
Type
TProc = Reference to Procedure;
var
P : TProc;
Procedure Testit;
begin
P:=procedure
begin
end;
P;
end;
begin
Testit;
end.