diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index f5acc4689..8d26abf84 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 = "8"; public const string Build = "2"; - public const string Revision = "3085"; + public const string Revision = "3086"; 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 5dd7c4a72..7e3a3b34b 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=8 -%REVISION%=3085 %COREVERSION%=2 +%REVISION%=3086 +%MINOR%=8 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 6ed6ccb1a..f68bae829 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.8.2.3085 +3.8.2.3086 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 292262020..f5da4c4be 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.8.2.3085' +!define VERSION '3.8.2.3086' diff --git a/SyntaxVisitors/SugarVisitors/LoopDesugarVisitor.cs b/SyntaxVisitors/SugarVisitors/LoopDesugarVisitor.cs index c7cbcceed..391256a3c 100644 --- a/SyntaxVisitors/SugarVisitors/LoopDesugarVisitor.cs +++ b/SyntaxVisitors/SugarVisitors/LoopDesugarVisitor.cs @@ -64,6 +64,10 @@ namespace SyntaxVisitors.SugarVisitors var avar = new var_statement(a, fn.initial_value, fn.initial_value.source_context); var bvar = new var_statement(b, fn.finish_value, fn.finish_value.source_context); var hvar = new var_statement(h, "integer", fn.increment_value, fn.increment_value.source_context); + var bexhe0 = new bin_expr(h.TypedClone(), new int32_const(0), Operators.Equal, h.source_context); + var raise = new raise_stmt(new new_expr("PABCSystem.ZeroStepException"), null,h.source_context); + var if0 = new if_node(bexhe0, raise, null, h.source_context); + statement ivar = null; if (fn.create_loop_variable || fn.type_name != null) { ivar = new var_statement(i, fn.type_name, a); ivar.source_context = a.source_context; } @@ -100,7 +104,7 @@ namespace SyntaxVisitors.SugarVisitors var semCheck1 = new semantic_check_sugared_statement_node(typeof(for_node), new List { a,b }, a.source_context); var for_st = new for_node(j, new int32_const(1), n, stlist, fn.statements.source_context); - var mainstlist = new statement_list(avar, bvar, semCheck1, oavar, obvar, hvar, nvar, ifn, ivar, for_st); + var mainstlist = new statement_list(avar, bvar, semCheck1, oavar, obvar, hvar, if0, nvar, ifn, ivar, for_st); mainstlist.source_context = avar.source_context; ReplaceUsingParent(fn, mainstlist); diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 6be6d76b6..ec35137a1 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -2841,6 +2841,13 @@ function IsInputPipedOrRedirectedFromFile: boolean; ///-- function CheckAndCorrectFromToAndCalcCountForSystemSlice(situation: integer; Len: integer; var from, &to: integer; step: integer): integer; + +type + ///-- + ZeroStepException = class(exception) + constructor Create; + end; + // ----------------------------------------------------- // Internal procedures for PABCRTL.dll @@ -2902,6 +2909,7 @@ const COUNT_PARAMS_MINFUN_MUSTBE_GREATER1 = 'Количество параметров функции Min должно быть > 1!!The number of parameters of the Min function must be > 1'; Format_InvalidString = 'Входная строка имела неверный формат!!Input string was not in a correct format'; Overflow_Int32 = 'Целочисленное переполнение!!Integer overflow'; + FOR_STEP_CANNOT_BE_EQUAL0 = 'Шаг цикла for не может быт равен 0!!Step of the for loop cannot be equal to 0'; // ----------------------------------------------------- // WINAPI // ----------------------------------------------------- @@ -2937,6 +2945,11 @@ begin Result := arr[0] end; +constructor ZeroStepException.Create; +begin + inherited Create(GetTranslation(FOR_STEP_CANNOT_BE_EQUAL0)) +end; + function IsWDE: boolean; begin Result := AppDomain.CurrentDomain.GetData('_RedirectIO_SpecialArgs') <> nil; diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 6be6d76b6..ec35137a1 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -2841,6 +2841,13 @@ function IsInputPipedOrRedirectedFromFile: boolean; ///-- function CheckAndCorrectFromToAndCalcCountForSystemSlice(situation: integer; Len: integer; var from, &to: integer; step: integer): integer; + +type + ///-- + ZeroStepException = class(exception) + constructor Create; + end; + // ----------------------------------------------------- // Internal procedures for PABCRTL.dll @@ -2902,6 +2909,7 @@ const COUNT_PARAMS_MINFUN_MUSTBE_GREATER1 = 'Количество параметров функции Min должно быть > 1!!The number of parameters of the Min function must be > 1'; Format_InvalidString = 'Входная строка имела неверный формат!!Input string was not in a correct format'; Overflow_Int32 = 'Целочисленное переполнение!!Integer overflow'; + FOR_STEP_CANNOT_BE_EQUAL0 = 'Шаг цикла for не может быт равен 0!!Step of the for loop cannot be equal to 0'; // ----------------------------------------------------- // WINAPI // ----------------------------------------------------- @@ -2937,6 +2945,11 @@ begin Result := arr[0] end; +constructor ZeroStepException.Create; +begin + inherited Create(GetTranslation(FOR_STEP_CANNOT_BE_EQUAL0)) +end; + function IsWDE: boolean; begin Result := AppDomain.CurrentDomain.GetData('_RedirectIO_SpecialArgs') <> nil;