From 717b73cb608a9c0f72f607302296406d2b89e00b Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Fri, 21 Jun 2019 09:36:54 +0300 Subject: [PATCH] fix #2007 --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/CompilationSamples/BlockFileOfT.pas | 12 ++++++------ TestSuite/CompilationSamples/PABCSystem.pas | 2 ++ TestSuite/Lambda_double_capture_b-6.pas | 16 ++++++++++++++++ .../Closure/CapturedVariablesTreeBuilder.cs | 11 +++++++---- 7 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 TestSuite/Lambda_double_capture_b-6.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 7ef53a5c9..d8a5c248f 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 = "2129"; + public const string Revision = "2133"; 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 e71f7a5ec..0dcbcb507 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %MINOR%=5 -%REVISION%=2129 +%REVISION%=2133 %COREVERSION%=0 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index e8ef2de16..e037f5605 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.5.0.2129' +!define VERSION '3.5.0.2133' diff --git a/TestSuite/CompilationSamples/BlockFileOfT.pas b/TestSuite/CompilationSamples/BlockFileOfT.pas index a05067376..4ccf15bd1 100644 --- a/TestSuite/CompilationSamples/BlockFileOfT.pas +++ b/TestSuite/CompilationSamples/BlockFileOfT.pas @@ -1,14 +1,14 @@ -(************************************************************************************) +//*****************************************************************************************************\\ // Copyright (©) Cergey Latchenko ( github.com/SunSerega | forum.mmcs.sfedu.ru/u/sun_serega ) // This code is distributed under the Unlicense -// For details please see LICENSE.md or here: +// For details see LICENSE.md file or this: // https://github.com/SunSerega/PascalABC.Net-BlockFileOfT/blob/master/LICENSE.md -(************************************************************************************) -// Copyright (©) Сергей латченко ( github.com/SunSerega | forum.mmcs.sfedu.ru/u/sun_serega ) +//*****************************************************************************************************\\ +// Copyright (©) Сергей Латченко ( github.com/SunSerega | forum.mmcs.sfedu.ru/u/sun_serega ) // Этот код распространяется под Unlicense -// Для деталей смотрите в файл LICENSE.md или сюда: +// Для деталей смотрите в файл LICENSE.md или это: // https://github.com/SunSerega/PascalABC.Net-BlockFileOfT/blob/master/LICENSE.md -(************************************************************************************) +//*****************************************************************************************************\\ ///Модуль, содержащий тип BlockFileOf ///Тип-альтернатива стандартному file of T diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index da4b5f374..81b735561 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -3950,6 +3950,8 @@ end; function operator**(x: real; n: integer): real; extensionmethod := Power(x, n); +function operator**(x: single; n: integer): real; extensionmethod := Power(x, n); + function operator**(x, y: integer): real; extensionmethod := Power(real(x), y); function operator**(x, y: real): real; extensionmethod := Power(x, y); diff --git a/TestSuite/Lambda_double_capture_b-6.pas b/TestSuite/Lambda_double_capture_b-6.pas new file mode 100644 index 000000000..003c7e485 --- /dev/null +++ b/TestSuite/Lambda_double_capture_b-6.pas @@ -0,0 +1,16 @@ +type + t0 = class end; + t1 = class(t0) + public procedure p1(); + begin + var b: T; + var p: procedure := ()-> + begin + var b1 := b; + var b2 := b; + end; + 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 f5de2aead..61165b515 100644 --- a/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs +++ b/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs @@ -392,12 +392,13 @@ namespace TreeConverter.LambdaExpressions.Closure if (idRef == null) //TODO: Осторожнее переделать { { - /*var index = -1; + var index = -1; for (var i=0; i < sc.VariablesDefinedInScope.Count; i++) { if (sc.VariablesDefinedInScope[i].SymbolInfo.sym_info is var_definition_node vdn && vdn.name.ToLower() == id.name.ToLower()) // SSM #2001 и подобные - исключаю одноимённые { index = i; + si = sc.VariablesDefinedInScope[i].SymbolInfo; break; } } @@ -406,14 +407,16 @@ namespace TreeConverter.LambdaExpressions.Closure sc.VariablesDefinedInScope.Add(new CapturedVariablesTreeNode.CapturedSymbolInfo(null, si)); index = sc.VariablesDefinedInScope.Count - 1; } - - idRef = sc.VariablesDefinedInScope[index];*/ - return; // SSM 21/06/19 - так было + idRef = sc.VariablesDefinedInScope[index]; + if (!(idRef.SymbolInfo.sym_info is IVAriableDefinitionNode)) + return; // SSM 21/06/19 - так было } } if (_currentTreeNode.CorrespondingSyntaxTreeNode != null) { + if (!(idRef.SymbolInfo.sym_info is IVAriableDefinitionNode)) // SSM 21/06/19 + return; var varName = ((IVAriableDefinitionNode)idRef.SymbolInfo.sym_info).name; //TODO: случай параметров и полей класса!!!!!!!!!!!!!!!!!! var substKey = new SubstitutionKey(varName, idRef.SyntaxTreeNodeWithVarDeclaration, _currentTreeNode.CorrespondingSyntaxTreeNode);