diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index fdfb7f50c..580b08262 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 = "6"; public const string Build = "3"; - public const string Revision = "2523"; + public const string Revision = "2527"; 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 b7cd4ce3e..d6c797f24 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %MINOR%=6 -%REVISION%=2523 +%REVISION%=2527 %COREVERSION%=3 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index a546fc604..9b8561282 100644 Binary files a/Localization/DefaultLang.resources and b/Localization/DefaultLang.resources differ diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index dfd5f4a5a..9020a62ca 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.6.3.2523 +3.6.3.2527 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 0c859e155..1ddc853ef 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.6.3.2523' +!define VERSION '3.6.3.2527' diff --git a/TestSuite/gotobad0.pas b/TestSuite/gotobad0.pas new file mode 100644 index 000000000..11d8cc792 --- /dev/null +++ b/TestSuite/gotobad0.pas @@ -0,0 +1,9 @@ +// #2271 +label 1; + +begin + Arr(3).Select(b -> b); + if True then + goto 1; + 1: Assert(1=1); +end. diff --git a/TestSuite/gotobad1.pas b/TestSuite/gotobad1.pas new file mode 100644 index 000000000..ac92e5775 --- /dev/null +++ b/TestSuite/gotobad1.pas @@ -0,0 +1,13 @@ +// #2271 +procedure p; +label 1; +begin + Arr(3).Select(b -> b); + if True then + goto 1; + 1: Assert(1=1); +end; + +begin + p; +end. diff --git a/TestSuite/gotobad2.pas b/TestSuite/gotobad2.pas new file mode 100644 index 000000000..327764fd0 --- /dev/null +++ b/TestSuite/gotobad2.pas @@ -0,0 +1,15 @@ +// #2271 +type + A = class + procedure p; + label 1; + begin + Arr(3).Select(b -> b); + if True then + goto 1; + 1: Print(1); + end; + end; + +begin +end. diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index a7ceb1829..2ed7cf32e 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -2767,6 +2767,22 @@ namespace PascalABCCompiler.TreeConverter lambdaProcessingState = LambdaProcessingState.TypeInferencePhase; visit_program_code(_block.program_code); + // Очистили списки goto для меток перед следующим этапом - пока ничего не дало - закомментируем + foreach (var l in context._cmn.labels) + { + l.goto_statements.Clear(); + l.comprehensive_code_block = null; + } + if (context.func_stack.size > 0) + { + var fun = context.func_stack.top(); + foreach (var l in fun.label_nodes_list) + { + l.goto_statements.Clear(); + l.comprehensive_code_block = null; + } + } + // Грубо - удаление мусора при разборе лямбд. Происходит исключение - заголовок разбирается, тело остается пустым - и из-за этого была ошибка #1270. 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")) { @@ -8918,7 +8934,8 @@ namespace PascalABCCompiler.TreeConverter lab.goto_statements.Add(gs); if (lab.comprehensive_code_block != null) { - if (!context.check_can_goto(lab.comprehensive_code_block, gs.comprehensive_code_block) && _goto_statement.source_context != null) + // последнее условие - для goto, которые генерируются в автомате yield, не рассматривать эту ошибку + if (!context.check_can_goto(lab.comprehensive_code_block, gs.comprehensive_code_block) && _goto_statement.source_context != null) { AddError(gs.location, "BLOCKED_LABEL_{0}_GOTO", lab.name); }