From d5c603e1d68106469138d8d452fdf5df7c179538 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Fri, 28 Jun 2019 11:26:02 +0300 Subject: [PATCH] fix #1641 --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 2 +- Localization/DefaultLang.resources | Bin 90948 -> 91076 bytes ReleaseGenerators/PascalABCNET_version.nsh | 2 +- .../YieldVisitors/LoweringVisitor.cs | 6 +++++- TestSuite/yield_lambda_with_foreach.pas | 12 ++++++++++++ .../TreeConversion/syntax_tree_visitor.cs | 2 +- 7 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 TestSuite/yield_lambda_with_foreach.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 713dab77b..32b5ffe53 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 = "2155"; + public const string Revision = "2157"; 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 f9e3f858e..1294e9e0e 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %MINOR%=5 -%REVISION%=2155 +%REVISION%=2157 %COREVERSION%=0 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 1966e8b6951c8efa51e4a91429a538ef16288ece..3cee1910eaa90b6c89d98e620f0f1298db367be0 100644 GIT binary patch delta 132 zcmX?djP=NI)(H<7A8dSBwIn+r$lux3B{ax2J|r^0H9pwGKh(!1-pMsS$Th&n5hxY! z6bX^?bM$qM_wV40m(g>{y>0Hd~@v5=X(Kjw?$n5 delta 19 bcmX?dob|{t)(H<76E;4qTC(}}(wBPyYK04W diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 5644806fd..b48c6d068 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.5.0.2155' +!define VERSION '3.5.0.2157' diff --git a/SyntaxVisitors/YieldVisitors/LoweringVisitor.cs b/SyntaxVisitors/YieldVisitors/LoweringVisitor.cs index cc1009b6e..f7f40bf22 100644 --- a/SyntaxVisitors/YieldVisitors/LoweringVisitor.cs +++ b/SyntaxVisitors/YieldVisitors/LoweringVisitor.cs @@ -339,7 +339,11 @@ namespace SyntaxVisitors bl.defs.Add(new label_definitions(gotoBreak.label, gotoContinue.label)); } - + public override void visit(function_lambda_definition fld) + { + // Нельзя Lowerить содержимое лямбды !!! Баг #1641! + } + public override void visit(for_node fn) { var b = HasStatementVisitor.Has(fn); diff --git a/TestSuite/yield_lambda_with_foreach.pas b/TestSuite/yield_lambda_with_foreach.pas new file mode 100644 index 000000000..0ff456ee6 --- /dev/null +++ b/TestSuite/yield_lambda_with_foreach.pas @@ -0,0 +1,12 @@ +function f1: sequence of string; +begin + var p: ()->() := procedure-> + begin + foreach var i in Arr(0) do; + end; + yield 'a'; +end; + +begin + Assert(f1.First = 'a'); +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index c41dda9f7..de47f0718 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -19849,7 +19849,7 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.sequence_type _sequence_type) // сахарный узел { - var pt = _sequence_type.elements_type.DescendantNodes().FirstOrDefault(s => s is procedure_header); + var pt = _sequence_type.elements_type.DescendantNodes(TraversalType.PostOrder,null,true).FirstOrDefault(s => s is procedure_header); if (pt != null) { AddError(get_location(pt), "PROCEDURE_TYPE_SHOULD_BE_REPLACED_BY_TYPE_NAME_IN_THIS_CONTEXT");