From 95a93215fb273cf991db73c59b3ce254d7b39903 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Wed, 26 Jun 2019 16:39:47 +0300 Subject: [PATCH] fix #1893 --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/lambda_2_lambda.pas | 25 +++++++++++++++++++ .../Closure/CapturedVariablesTreeBuilder.cs | 6 ++--- 5 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 TestSuite/lambda_2_lambda.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 707b7961c..d02a211e4 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 = "2151"; + public const string Revision = "2153"; 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 9d542cb42..a8cbaaee1 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %MINOR%=5 -%REVISION%=2151 +%REVISION%=2153 %COREVERSION%=0 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index b6a3390ef..73786856e 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.5.0.2151' +!define VERSION '3.5.0.2153' diff --git a/TestSuite/lambda_2_lambda.pas b/TestSuite/lambda_2_lambda.pas new file mode 100644 index 000000000..364f6a559 --- /dev/null +++ b/TestSuite/lambda_2_lambda.pas @@ -0,0 +1,25 @@ +type + t1 = class + pf: procedure; + + procedure p1; + begin + var obj: byte; + + var lp2: procedure := ()-> + begin + obj := obj; + pf := ()-> + begin + Print(1); + end; + pf; + end; + lp2; + end; + + end; + +begin + t1.Create.p1; +end. \ No newline at end of file diff --git a/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs b/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs index ec6e0a299..d473dcd03 100644 --- a/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs +++ b/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs @@ -248,10 +248,10 @@ namespace TreeConverter.LambdaExpressions.Closure } if (ok) { - if (id.Parent is var_def_statement) + ProcessNode(dn); // SSM 26.06.19 #1893 + /*if (id.Parent is var_def_statement) ProcessNode(dn); // Грубая правка, закрывающая ошибку #1390 // SSM 19.06.19 заменил id на dn - else ProcessNode(id.Parent); // Грубо, поскольку id.Parent уже начал обходиться - а здесь рекурсия - // Это рубится на коде var s := c; где s - локальная в лямбде, а c - захваченное поле класса. В результате s создаётся дважды. + else ProcessNode(dn); // Грубо, поскольку id.Parent уже начал обходиться - а здесь рекурсия // Это рубится на коде var s := c; где s - локальная в лямбде, а c - захваченное поле класса. В результате s создаётся дважды.*/ return; } }