fix #2271
This commit is contained in:
parent
15ebf4a4e4
commit
129cefd7e7
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
||||||
public const string Major = "3";
|
public const string Major = "3";
|
||||||
public const string Minor = "6";
|
public const string Minor = "6";
|
||||||
public const string Build = "3";
|
public const string Build = "3";
|
||||||
public const string Revision = "2523";
|
public const string Revision = "2527";
|
||||||
|
|
||||||
public const string MainVersion = Major + "." + Minor;
|
public const string MainVersion = Major + "." + Minor;
|
||||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%MINOR%=6
|
%MINOR%=6
|
||||||
%REVISION%=2523
|
%REVISION%=2527
|
||||||
%COREVERSION%=3
|
%COREVERSION%=3
|
||||||
%MAJOR%=3
|
%MAJOR%=3
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
3.6.3.2523
|
3.6.3.2527
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
!define VERSION '3.6.3.2523'
|
!define VERSION '3.6.3.2527'
|
||||||
|
|
|
||||||
9
TestSuite/gotobad0.pas
Normal file
9
TestSuite/gotobad0.pas
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
// #2271
|
||||||
|
label 1;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Arr(3).Select(b -> b);
|
||||||
|
if True then
|
||||||
|
goto 1;
|
||||||
|
1: Assert(1=1);
|
||||||
|
end.
|
||||||
13
TestSuite/gotobad1.pas
Normal file
13
TestSuite/gotobad1.pas
Normal file
|
|
@ -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.
|
||||||
15
TestSuite/gotobad2.pas
Normal file
15
TestSuite/gotobad2.pas
Normal file
|
|
@ -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.
|
||||||
|
|
@ -2767,6 +2767,22 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
lambdaProcessingState = LambdaProcessingState.TypeInferencePhase;
|
lambdaProcessingState = LambdaProcessingState.TypeInferencePhase;
|
||||||
visit_program_code(_block.program_code);
|
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.
|
// Грубо - удаление мусора при разборе лямбд. Происходит исключение - заголовок разбирается, тело остается пустым - и из-за этого была ошибка #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"))
|
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,6 +8934,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
lab.goto_statements.Add(gs);
|
lab.goto_statements.Add(gs);
|
||||||
if (lab.comprehensive_code_block != null)
|
if (lab.comprehensive_code_block != null)
|
||||||
{
|
{
|
||||||
|
// последнее условие - для goto, которые генерируются в автомате yield, не рассматривать эту ошибку
|
||||||
if (!context.check_can_goto(lab.comprehensive_code_block, gs.comprehensive_code_block) && _goto_statement.source_context != null)
|
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);
|
AddError(gs.location, "BLOCKED_LABEL_{0}_GOTO", lab.name);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue