From d299d70a23645fb5c27f2d7cb70ad090cd48b5a0 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Sun, 23 Jun 2019 22:00:52 +0300 Subject: [PATCH] fix #2009 --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/lambda_static_1.pas | 16 ++++++++++++++++ .../Closure/CapturedVariablesTreeBuilder.cs | 4 ++-- 5 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 TestSuite/lambda_static_1.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 27e80cbbc..d1158ce4d 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 = "2144"; + public const string Revision = "2146"; 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 d1bc240e1..29124c89e 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=0 -%REVISION%=2144 +%REVISION%=2146 %MINOR%=5 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index de1ab49c2..e364b02c9 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.5.0.2144' +!define VERSION '3.5.0.2146' diff --git a/TestSuite/lambda_static_1.pas b/TestSuite/lambda_static_1.pas new file mode 100644 index 000000000..545f097ca --- /dev/null +++ b/TestSuite/lambda_static_1.pas @@ -0,0 +1,16 @@ +type + T = class + public static function f: T := new T; //Обязательно static + + public procedure P; + begin + var s := f; // Повторно объявленный идентификатор s + // Если добавить (), то всё работает + + var lambda: () -> integer = () -> 1; //любая лямбда + 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 15489ef5a..ec6e0a299 100644 --- a/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs +++ b/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs @@ -209,7 +209,7 @@ namespace TreeConverter.LambdaExpressions.Closure { dot_node dn = null; // Поменял принцип добавления имени класса для статических полей и функций - Func getClassIdent = (classNode) => + Func getClassIdent = classNode => { if (classNode.name.Contains("<")) { @@ -291,7 +291,7 @@ namespace TreeConverter.LambdaExpressions.Closure cname = (cd.Parent as type_declaration).type_name; dot_node dn = new dot_node(new ident(cname.name, cname.source_context), new ident(id.name, id.source_context), id.source_context); id.Parent.ReplaceDescendantUnsafe(id, dn); - ProcessNode(id.Parent); + ProcessNode(dn); } return; }