step = 0 - хорошее runtime сообщение об ошибке

This commit is contained in:
Mikhalkovich Stanislav 2022-02-27 19:58:49 +03:00
parent 3240593d2e
commit 86dd24c5b6
7 changed files with 36 additions and 6 deletions

View file

@ -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;

View file

@ -1,4 +1,4 @@
%MINOR%=8
%REVISION%=3085
%COREVERSION%=2
%REVISION%=3086
%MINOR%=8
%MAJOR%=3

View file

@ -1 +1 @@
3.8.2.3085
3.8.2.3086

View file

@ -1 +1 @@
!define VERSION '3.8.2.3085'
!define VERSION '3.8.2.3086'

View file

@ -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<syntax_tree_node> { 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);

View file

@ -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;

View file

@ -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;