fix #1711
This commit is contained in:
parent
7068aedb0d
commit
da47253f24
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "7";
|
||||
public const string Build = "1";
|
||||
public const string Revision = "2787";
|
||||
public const string Revision = "2792";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=7
|
||||
%REVISION%=2787
|
||||
%COREVERSION%=1
|
||||
%REVISION%=2792
|
||||
%MINOR%=7
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
3.7.1.2787
|
||||
3.7.1.2792
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.7.1.2787'
|
||||
!define VERSION '3.7.1.2792'
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace PascalABCCompiler.SyntaxTreeConverters
|
|||
// Unnamed Records перенёс сюда
|
||||
UnnamedRecordsCheckVisitor.New.ProcessNode(root);
|
||||
|
||||
// Выносим выражения с лямбдами из заголовка foreach
|
||||
// Выносим выражения с лямбдами из заголовка foreach + считаем максимум 10 вложенных лямбд
|
||||
StandOutExprWithLambdaInForeachSequenceVisitor.New.ProcessNode(root);
|
||||
VarNamesInMethodsWithSameNameAsClassGenericParamsReplacer.New.ProcessNode(root); // SSM bug fix #1147
|
||||
FindOnExceptVarsAndApplyRenameVisitor.New.ProcessNode(root);
|
||||
|
|
|
|||
|
|
@ -45,5 +45,15 @@ namespace PascalABCCompiler.SyntaxTreeConverters
|
|||
|
||||
base.visit(fe);
|
||||
}
|
||||
|
||||
private int countNestedLambdas = 0;
|
||||
public override void visit(function_lambda_definition fld)
|
||||
{
|
||||
countNestedLambdas += 1;
|
||||
if (countNestedLambdas>10)
|
||||
throw new SyntaxVisitors.SyntaxVisitorError("NESTED_LAMBDAS_MAXIMUM_10", fld.source_context);
|
||||
ProcessNode(fld.proc_body);
|
||||
countNestedLambdas -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -53,9 +53,6 @@ function НОК(a, b: int64): int64;
|
|||
/// Возвращает НОД и НОК пары чисел
|
||||
function НОДНОК(a, b: int64): (int64, int64);
|
||||
|
||||
/// Разложение числа на простые множители
|
||||
function Factorize(n: int64): List<int64>;
|
||||
|
||||
/// Разложение числа на простые множители
|
||||
function Factorize(n: integer): List<integer>;
|
||||
|
||||
|
|
@ -68,9 +65,6 @@ function FirstPrimes(n: integer): List<integer>;
|
|||
/// Возвращает список, содержащий цифры числа
|
||||
function Digits(n: int64): List<integer>;
|
||||
|
||||
/// Возвращает список делителей натурального числа
|
||||
function Divizors(n: int64): List<int64>;
|
||||
|
||||
/// Возвращает список делителей натурального числа
|
||||
function Divizors(n: integer): List<integer>;
|
||||
|
||||
|
|
@ -406,27 +400,6 @@ end;
|
|||
|
||||
{$region Factorize}
|
||||
|
||||
/// Разложение числа на простые множители
|
||||
function Factorize(n: int64): List<int64>;
|
||||
begin
|
||||
n := Abs(n);
|
||||
var i: int64 := 2;
|
||||
var L := new List<int64>;
|
||||
while i * i <= n do
|
||||
if n mod i = 0 then
|
||||
begin
|
||||
L.Add(i);
|
||||
n := n div i;
|
||||
if n < i then
|
||||
break
|
||||
end
|
||||
else
|
||||
i += i = 2 ? 1 : 2;
|
||||
if n > 1 then
|
||||
L.Add(n);
|
||||
Result := L
|
||||
end;
|
||||
|
||||
/// Разложение числа на простые множители
|
||||
function Factorize(n: integer): List<integer>;
|
||||
begin
|
||||
|
|
@ -448,10 +421,6 @@ begin
|
|||
Result := L
|
||||
end;
|
||||
|
||||
/// разложение числа на простые множители
|
||||
function Factorize(Self: int64): List<int64>; extensionmethod :=
|
||||
Factorize(Self);
|
||||
|
||||
/// Разложение числа на простые множители
|
||||
function Factorize(Self: integer): List<integer>; extensionmethod :=
|
||||
Factorize(Self);
|
||||
|
|
@ -519,42 +488,22 @@ end;
|
|||
|
||||
/// возвращает True, если число простое и False в противном случае
|
||||
function IsPrime(Self: integer): boolean; extensionmethod;
|
||||
begin
|
||||
if Self < 2 then
|
||||
begin
|
||||
Result := False;
|
||||
exit
|
||||
end;
|
||||
var i := 2;
|
||||
while i * i <= Self do
|
||||
if Self mod i = 0 then
|
||||
begin
|
||||
Result := False;
|
||||
exit
|
||||
end
|
||||
else
|
||||
i += if i = 2 then 1 else 2;
|
||||
Result := True
|
||||
end;
|
||||
|
||||
/// возвращает True, если число простое и False в противном случае
|
||||
function IsPrime(Self: int64): boolean; extensionmethod;
|
||||
begin
|
||||
if Self < 2 then
|
||||
begin
|
||||
Result := False;
|
||||
exit
|
||||
end;
|
||||
var i := int64(2);
|
||||
while i * i <= Self do
|
||||
if Self mod i = 0 then
|
||||
begin
|
||||
Result := False;
|
||||
exit
|
||||
end
|
||||
else
|
||||
i += if i = 2 then 1 else 2;
|
||||
Result := True
|
||||
begin
|
||||
if Self = 2 then
|
||||
Result := True
|
||||
else if Self.IsEven or (Self <= 1) then
|
||||
Result := False
|
||||
else begin
|
||||
var i := int64(3);
|
||||
Result := True;
|
||||
while i * i <= Self do
|
||||
if Self mod i = 0 then begin
|
||||
Result := False;
|
||||
exit
|
||||
end
|
||||
else
|
||||
i += 2
|
||||
end
|
||||
end;
|
||||
|
||||
{$endregion}
|
||||
|
|
@ -619,40 +568,10 @@ begin
|
|||
Result := L
|
||||
end;
|
||||
|
||||
/// возвращает список всех делителей натурального числа
|
||||
function Divizors(n: int64): List<int64>;
|
||||
begin
|
||||
n := Abs(n); // foolproof
|
||||
var L := new List<int64>;
|
||||
L.Add(1);
|
||||
L.Add(n);
|
||||
if n > 3 then
|
||||
begin
|
||||
var k := int64(2);
|
||||
while (k * k <= n) and (k < 3037000500) do
|
||||
begin
|
||||
if n mod k = 0 then
|
||||
begin
|
||||
var t := n div k;
|
||||
L.Add(k);
|
||||
if k < t then L.Add(t)
|
||||
else break
|
||||
end;
|
||||
Inc(k)
|
||||
end;
|
||||
L.Sort;
|
||||
end;
|
||||
Result := L
|
||||
end;
|
||||
|
||||
/// возвращает список делителей натурального числа
|
||||
function Divizors(Self: integer): List<integer>; extensionmethod :=
|
||||
Divizors(Self);
|
||||
|
||||
/// возвращает список делителей натурального числа
|
||||
function Divizors(Self: int64): List<int64>; extensionmethod :=
|
||||
Divizors(Self);
|
||||
|
||||
{$endregion}
|
||||
|
||||
{$region Trig}
|
||||
|
|
|
|||
|
|
@ -36,3 +36,4 @@ NESTED_RECORD_CAN_CONTAIN_ONLY_ONE_PUBLIC_VISIBILITY_SECTION=Nested records can
|
|||
NESTED_RECORD_CANNOT_CONTAIN_SEVERAL_VISIBILITY_SECTIONS=Nested records can not contain several visibility section
|
||||
UNNAMED_RECORD_CANNOT_CATCH_NAMES_FROM_NONGLOBAL_CONTEXT=Nested records cannot catch names from nonglobal context
|
||||
TOO_MANY_ELEMENTS_ON_LEFT_SIDE_OF_TUPLE_ASSIGNMENT=Too many elements on the left side of tuple assignment
|
||||
NESTED_LAMBDAS_MAXIMUM_10=Maximum number of nested lambdas = 10
|
||||
|
|
@ -39,4 +39,5 @@ NESTED_RECORD_CANNOT_CONTAIN_CONSTRUCTORS=Вложенные записи не
|
|||
NESTED_RECORD_CAN_CONTAIN_ONLY_ONE_PUBLIC_VISIBILITY_SECTION=Вложенные записи могут содержать лишь одну секцию с public-видимостью
|
||||
NESTED_RECORD_CANNOT_CONTAIN_SEVERAL_VISIBILITY_SECTIONS=Вложенные записи не могут содержать несколько секций видимости
|
||||
NESTED_RECORD_CANNOT_CATCH_NAMES_FROM_NONGLOBAL_CONTEXT=Вложенные записи не могут захватывать имена из неглобального контекста
|
||||
TOO_MANY_ELEMENTS_ON_LEFT_SIDE_OF_TUPLE_ASSIGNMENT=Слишком много элементов в левой части при присваивании кортежа
|
||||
TOO_MANY_ELEMENTS_ON_LEFT_SIDE_OF_TUPLE_ASSIGNMENT=Слишком много элементов в левой части при присваивании кортежа
|
||||
NESTED_LAMBDAS_MAXIMUM_10=Максимальный уровень вложенности лямбд равен 10
|
||||
Loading…
Reference in a new issue