diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index b5a0b0780..a4fba5d9c 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "5"; public const string Build = "0"; - public const string Revision = "2110"; + public const string Revision = "2111"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index 3b542fc74..55328ce38 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=0 -%REVISION%=2110 %MINOR%=5 +%REVISION%=2111 +%COREVERSION%=0 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 9f2260a75..2ff016197 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.5.0.2110' +!define VERSION '3.5.0.2111' diff --git a/TestSuite/lambda_capture_T_1.pas b/TestSuite/lambda_capture_T_1.pas new file mode 100644 index 000000000..cb62441e1 --- /dev/null +++ b/TestSuite/lambda_capture_T_1.pas @@ -0,0 +1,16 @@ +type + t1=class + procedure p1(); + begin + var t: byte := 2; + var p: procedure(t1: integer) := t -> + begin + Assert(t=3); + end; + p(3); + end; + end; + +begin + t1&.Create.p1 +end. \ No newline at end of file diff --git a/TestSuite/lambda_capture_T_2.pas b/TestSuite/lambda_capture_T_2.pas new file mode 100644 index 000000000..9f1f6c911 --- /dev/null +++ b/TestSuite/lambda_capture_T_2.pas @@ -0,0 +1,16 @@ +type + t1=class + procedure p1(); + begin + var t: byte := 2; + var p: procedure(t1: integer) := t1 -> + begin + Assert(t=2); + end; + p(3); + end; + end; + +begin + t1&.Create.p1 +end. \ No newline at end of file diff --git a/TestSuite/lambda_capture_T_3.pas b/TestSuite/lambda_capture_T_3.pas new file mode 100644 index 000000000..5e85728be --- /dev/null +++ b/TestSuite/lambda_capture_T_3.pas @@ -0,0 +1,17 @@ +type + t1=class + function p1(t: byte := 4): integer; + end; + +function t1.p1(t: byte): integer; +begin + var p: procedure := () -> + begin + Assert(t=4); + end; + p; +end; + +begin + t1&.Create.p1 +end. \ No newline at end of file diff --git a/TestSuite/lambda_capture_T_4.pas b/TestSuite/lambda_capture_T_4.pas new file mode 100644 index 000000000..239ac0046 --- /dev/null +++ b/TestSuite/lambda_capture_T_4.pas @@ -0,0 +1,15 @@ +type + t1=class + procedure p1(t: byte := 2); + begin + var p: procedure(t1: integer) := t1 -> + begin + Assert(t=2); + end; + p(3); + end; + end; + +begin + t1&.Create.p1 +end. \ No newline at end of file diff --git a/TestSuite/lambda_capture_T_5.pas b/TestSuite/lambda_capture_T_5.pas new file mode 100644 index 000000000..698d55feb --- /dev/null +++ b/TestSuite/lambda_capture_T_5.pas @@ -0,0 +1,18 @@ +type + t1=class + function p1(t3: byte := 2): integer; + end; + +function t1.p1(t3: byte): integer; +begin + var t: integer := 6; + var p: procedure := () -> + begin + Assert(t=6); + end; + p; +end; + +begin + t1&.Create.p1 +end. \ No newline at end of file diff --git a/TestSuite/lambda_new_init_const.pas b/TestSuite/lambda_new_init_const.pas new file mode 100644 index 000000000..20cc72c3e --- /dev/null +++ b/TestSuite/lambda_new_init_const.pas @@ -0,0 +1,10 @@ +procedure p1; +begin + var o: object; + var p: procedure := procedure -> begin + (new object[](o)).Sort; + end; +end; + +begin +end. \ No newline at end of file diff --git a/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs b/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs index 1846e92bd..70b7b5cfd 100644 --- a/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs +++ b/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs @@ -130,6 +130,7 @@ namespace TreeConverter.LambdaExpressions.Closure expression expr = newExpr.params_list.expressions[i]; ProcessNode(expr); } + ProcessNode(newExpr.array_init_expr); } } diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index c2376eae9..b272a593a 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -2743,7 +2743,7 @@ namespace PascalABCCompiler.TreeConverter while (context._cmn.functions.Count > 0 && context._cmn.functions[context._cmn.functions.Count-1].function_code == null && context._cmn.functions[context._cmn.functions.Count - 1].name.StartsWith("<>lambda") && !context._cmn.functions[context._cmn.functions.Count - 1].name.StartsWith("<>lambda_initializer")) { #if DEBUG - System.IO.File.AppendAllText("d:\\aa.txt", context._cmn.functions[context._cmn.functions.Count - 1].name+"\n"); + System.IO.File.AppendAllText("aa.txt", context._cmn.functions[context._cmn.functions.Count - 1].name+"\n"); #endif context._cmn.functions.remove_at(context._cmn.functions.Count - 1);