bug fix #918
This commit is contained in:
parent
553e7fbd24
commit
a1e1363347
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "4";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "1678";
|
||||
public const string Revision = "1682";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=4
|
||||
%REVISION%=1678
|
||||
%REVISION%=1682
|
||||
%COREVERSION%=0
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: DESKTOP-A6LT9RI
|
||||
// DateTime: 12.06.2018 22:19:29
|
||||
// DateTime: 28.06.2018 21:28:15
|
||||
// UserName: ?????????
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -836,6 +836,28 @@ const_factor
|
|||
}
|
||||
| sign const_factor
|
||||
{
|
||||
// ðó÷íàß êîððåêöèß öåëûõ êîíñòàíò
|
||||
if ($1.type == Operators.Minus)
|
||||
{
|
||||
var i64 = $2 as int64_const;
|
||||
if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1)
|
||||
{
|
||||
$$ = new int32_const(Int32.MinValue);
|
||||
break;
|
||||
}
|
||||
var ui64 = $2 as uint64_const;
|
||||
if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
$$ = new int64_const(Int64.MinValue);
|
||||
break;
|
||||
}
|
||||
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
parsertools.AddErrorFromResource("BAD_INT2",@$);
|
||||
break;
|
||||
}
|
||||
// ìîæíî ñäåëàòü âû÷èñëåíèå êîíñòàíòû ñ âìîíòèðîâàííûì ìèíóñîì
|
||||
}
|
||||
$$ = new un_expr($2, $1.type, @$);
|
||||
}
|
||||
| new_expr
|
||||
|
|
@ -3364,7 +3386,29 @@ factor
|
|||
$$ = new un_expr($2, $1.type, @$);
|
||||
}
|
||||
| sign factor
|
||||
{
|
||||
{
|
||||
if ($1.type == Operators.Minus)
|
||||
{
|
||||
var i64 = $2 as int64_const;
|
||||
if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1)
|
||||
{
|
||||
$$ = new int32_const(Int32.MinValue);
|
||||
break;
|
||||
}
|
||||
var ui64 = $2 as uint64_const;
|
||||
if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
$$ = new int64_const(Int64.MinValue);
|
||||
break;
|
||||
}
|
||||
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
parsertools.AddErrorFromResource("BAD_INT2",@$);
|
||||
break;
|
||||
}
|
||||
// ìîæíî ñäåëàòü âû÷èñëåíèå êîíñòàíòû ñ âìîíòèðîâàííûì ìèíóñîì
|
||||
}
|
||||
|
||||
$$ = new un_expr($2, $1.type, @$);
|
||||
}
|
||||
| tkDeref factor
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// GPPG version 1.3.6
|
||||
// Machine: DESKTOP-A6LT9RI
|
||||
// DateTime: 12.06.2018 22:19:30
|
||||
// DateTime: 28.06.2018 21:28:15
|
||||
// UserName: ?????????
|
||||
// Input file <ABCPascal.y>
|
||||
|
||||
|
|
@ -3163,6 +3163,28 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
|
|||
break;
|
||||
case 151: // const_factor -> sign, const_factor
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (ValueStack[ValueStack.Depth-2].op.type == Operators.Minus)
|
||||
{
|
||||
var i64 = ValueStack[ValueStack.Depth-1].ex as int64_const;
|
||||
if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1)
|
||||
{
|
||||
CurrentSemanticValue.ex = new int32_const(Int32.MinValue);
|
||||
break;
|
||||
}
|
||||
var ui64 = ValueStack[ValueStack.Depth-1].ex as uint64_const;
|
||||
if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
CurrentSemanticValue.ex = new int64_const(Int64.MinValue);
|
||||
break;
|
||||
}
|
||||
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
parsertools.AddErrorFromResource("BAD_INT2",CurrentLocationSpan);
|
||||
break;
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
CurrentSemanticValue.ex = new un_expr(ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan);
|
||||
}
|
||||
break;
|
||||
|
|
@ -5569,7 +5591,29 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
|
|||
}
|
||||
break;
|
||||
case 666: // factor -> sign, factor
|
||||
{
|
||||
{
|
||||
if (ValueStack[ValueStack.Depth-2].op.type == Operators.Minus)
|
||||
{
|
||||
var i64 = ValueStack[ValueStack.Depth-1].ex as int64_const;
|
||||
if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1)
|
||||
{
|
||||
CurrentSemanticValue.ex = new int32_const(Int32.MinValue);
|
||||
break;
|
||||
}
|
||||
var ui64 = ValueStack[ValueStack.Depth-1].ex as uint64_const;
|
||||
if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
CurrentSemanticValue.ex = new int64_const(Int64.MinValue);
|
||||
break;
|
||||
}
|
||||
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
|
||||
{
|
||||
parsertools.AddErrorFromResource("BAD_INT2",CurrentLocationSpan);
|
||||
break;
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
CurrentSemanticValue.ex = new un_expr(ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.4.0.1678'
|
||||
!define VERSION '3.4.0.1682'
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace PascalABCCompiler.SyntaxTreeConverters
|
|||
// Выносим выражения с лямбдами из заголовка foreach
|
||||
StandOutExprWithLambdaInForeachSequenceVisitor.New.ProcessNode(root);
|
||||
|
||||
//--- Обработка синтаксически сахарных узлов
|
||||
// type classes
|
||||
|
||||
{
|
||||
var typeclasses = SyntaxVisitors.TypeclassVisitors.FindTypeclassesVisitor.New;
|
||||
|
|
@ -32,7 +32,9 @@ namespace PascalABCCompiler.SyntaxTreeConverters
|
|||
SyntaxVisitors.TypeclassVisitors.ReplaceTypeclassVisitor.New(instancesAndRestrictedFunctions).ProcessNode(root);
|
||||
}
|
||||
root.FillParentsInAllChilds();
|
||||
#if DEBUG
|
||||
//new SimplePrettyPrinterVisitor("E:/projs/out.txt").ProcessNode(root);
|
||||
#endif
|
||||
// loop
|
||||
LoopDesugarVisitor.New.ProcessNode(root);
|
||||
|
||||
|
|
|
|||
|
|
@ -7455,17 +7455,12 @@ end;
|
|||
|
||||
function Pos(subs, s: string; from: integer): integer;
|
||||
begin
|
||||
if (subs = nil) or (subs.Length = 0) then
|
||||
if (subs = nil) or (subs.Length = 0) or (from > s.Length) then
|
||||
Result := 0
|
||||
else Result := s.IndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
|
||||
function PosEx(subs, s: string; from: integer): integer;
|
||||
begin
|
||||
if (subs = nil) or (subs.Length = 0) then
|
||||
Result := 0
|
||||
else Result := s.IndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
function PosEx(subs, s: string; from: integer) := Pos(subs,s,from);
|
||||
|
||||
function LastPos(subs, s: string): integer;
|
||||
begin
|
||||
|
|
@ -7476,20 +7471,19 @@ end;
|
|||
|
||||
function LastPos(subs, s: string; from: integer): integer;
|
||||
begin
|
||||
if (subs = nil) or (subs.Length = 0) then
|
||||
if (subs = nil) or (subs.Length = 0) or (from > s.Length) then
|
||||
Result := 0
|
||||
else Result := s.LastIndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
|
||||
function Pos(c: char; s: string; from: integer): integer;
|
||||
{function Pos(c: char; s: string; from: integer): integer;
|
||||
begin
|
||||
if from > s.Length then
|
||||
Result := 0;
|
||||
Result := s.IndexOf(c, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
|
||||
function PosEx(c: char; s: string; from: integer): integer;
|
||||
begin
|
||||
Result := s.IndexOf(c, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
function PosEx(c: char; s: string; from: integer) := Pos(c,s,from);
|
||||
|
||||
function LastPos(c: char; s: string): integer;
|
||||
begin
|
||||
|
|
@ -7498,8 +7492,10 @@ end;
|
|||
|
||||
function LastPos(c: char; s: string; from: integer): integer;
|
||||
begin
|
||||
if from > s.Length then
|
||||
Result := 0;
|
||||
Result := s.LastIndexOf(c, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
end;}
|
||||
|
||||
function Length(s: string): integer;
|
||||
begin
|
||||
|
|
@ -7530,7 +7526,7 @@ begin
|
|||
s := s.Substring(0, n)
|
||||
else if s.Length < n then
|
||||
if n <= sz then
|
||||
s += new string(' ', n - s.Length )
|
||||
s += new string(' ', n - s.Length)
|
||||
else
|
||||
s += new String(' ', sz - s.Length)
|
||||
end;
|
||||
|
|
@ -7543,12 +7539,6 @@ begin
|
|||
if index > s.Length + 1 then
|
||||
index := s.Length + 1;
|
||||
s := s.Insert(index - 1, source);
|
||||
{ try
|
||||
s := s.Insert(index - 1, source);
|
||||
except
|
||||
on e: System.Exception do
|
||||
s := s.Insert(s.Length, source);
|
||||
end;}
|
||||
end;
|
||||
|
||||
procedure InsertInShortString(source: string; var s: string; index, n: integer);
|
||||
|
|
@ -7589,14 +7579,6 @@ begin
|
|||
if index + count - 1 > s.Length then
|
||||
count := s.Length - index + 1;
|
||||
Result := s.SubString(index - 1, count);
|
||||
{ try
|
||||
if index - 1 >= s.Length then
|
||||
Result := ''
|
||||
else Result := s.SubString(index - 1, count);
|
||||
except
|
||||
on e: System.Exception do
|
||||
Result := s.Substring(index - 1, s.Length - index + 1);
|
||||
end;}
|
||||
end;
|
||||
|
||||
function Concat(s1, s2: string): string;
|
||||
|
|
|
|||
4
TestSuite/MinInt32Const.pas
Normal file
4
TestSuite/MinInt32Const.pas
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
begin
|
||||
var i: integer := -2147483648;
|
||||
Assert(i.GetType = typeof(integer));
|
||||
end.
|
||||
|
|
@ -1220,6 +1220,8 @@ function Power(x: BigInteger; y: integer): BigInteger;
|
|||
/// Возвращает x, округленное до ближайшего целого. Если вещественное находится посередине между двумя целыми,
|
||||
///то округление осуществляется к ближайшему четному (банковское округление): Round(2.5)=2, Round(3.5)=4
|
||||
function Round(x: real): integer;
|
||||
/// Возвращает x, округленное до ближайшего вещественного с digits знаками после десятичной точки
|
||||
function Round(x: real; digits: integer): real;
|
||||
/// Возвращает x, округленное до ближайшего длинного целого
|
||||
function RoundBigInteger(x: real): BigInteger;
|
||||
/// Возвращает целую часть вещественного числа x
|
||||
|
|
@ -2073,6 +2075,49 @@ type
|
|||
end;
|
||||
end;
|
||||
|
||||
|
||||
type
|
||||
///--
|
||||
__TypeclassRestrictedFunctionAttribute = class(Attribute)
|
||||
public
|
||||
constructor;
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
///--
|
||||
__TypeclassGenericParameterAttribute = class(Attribute)
|
||||
public
|
||||
constructor(instanceName: string);
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
|
||||
///--
|
||||
__TypeclassAttribute = class(Attribute)
|
||||
public
|
||||
constructor(typeclassName: string);
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
|
||||
///--
|
||||
__TypeclassMemberAttribute = class(Attribute)
|
||||
public
|
||||
constructor;
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
|
||||
///--
|
||||
__TypeclassInstanceAttribute = class(Attribute)
|
||||
public
|
||||
constructor(instanceName: string);
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Internal procedures for PABCRTL.dll
|
||||
// -----------------------------------------------------
|
||||
|
|
@ -3494,7 +3539,7 @@ begin
|
|||
Result := Self;
|
||||
end;
|
||||
|
||||
function operator=<T>(x,y: HashSet<T>): boolean; extensionmethod;
|
||||
function InternalEqual<T>(x,y: HashSet<T>): boolean;
|
||||
begin
|
||||
var xn := Object.ReferenceEquals(x,nil);
|
||||
var yn := Object.ReferenceEquals(y,nil);
|
||||
|
|
@ -3505,7 +3550,9 @@ begin
|
|||
else Result := x.SetEquals(y);
|
||||
end;
|
||||
|
||||
function operator<><T>(x,y: HashSet<T>); extensionmethod := not (x=y);
|
||||
function operator=<T>(x,y: HashSet<T>): boolean; extensionmethod := InternalEqual(x,y);
|
||||
|
||||
function operator<><T>(x,y: HashSet<T>); extensionmethod := not InternalEqual(x,y);
|
||||
|
||||
function operator-<T>(x, y: HashSet<T>): HashSet<T>; extensionmethod;
|
||||
begin
|
||||
|
|
@ -3579,7 +3626,7 @@ begin
|
|||
Result := Self;
|
||||
end;
|
||||
|
||||
function operator=<T>(x,y: SortedSet<T>): boolean; extensionmethod;
|
||||
function InternalEqual<T>(x,y: SortedSet<T>): boolean;
|
||||
begin
|
||||
var xn := Object.ReferenceEquals(x,nil);
|
||||
var yn := Object.ReferenceEquals(y,nil);
|
||||
|
|
@ -3590,7 +3637,9 @@ begin
|
|||
else Result := x.SetEquals(y);
|
||||
end;
|
||||
|
||||
function operator<><T>(x, y: SortedSet<T>); extensionmethod := not x.SetEquals(y);
|
||||
function operator=<T>(x,y: SortedSet<T>): boolean; extensionmethod := InternalEqual(x,y);
|
||||
|
||||
function operator<><T>(x, y: SortedSet<T>); extensionmethod := not InternalEqual(x,y);
|
||||
|
||||
function operator-<T>(x, y: SortedSet<T>): SortedSet<T>; extensionmethod;
|
||||
begin
|
||||
|
|
@ -4238,6 +4287,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
///--
|
||||
procedure Deconstruct<T>(self: T; var res: T); extensionmethod;
|
||||
begin
|
||||
res := self;
|
||||
|
|
@ -6594,14 +6644,14 @@ begin
|
|||
else if not cond then
|
||||
begin
|
||||
var err := 'Сбой подтверждения: ' + message + Environment.NewLine + 'Файл ' + sourceFile + ', строка ' + line.ToString();
|
||||
writeln(err);
|
||||
Writeln(err);
|
||||
System.Threading.Thread.Sleep(500);
|
||||
raise new Exception();
|
||||
end;
|
||||
end
|
||||
else
|
||||
//System.Diagnostics.Debug.Assert(cond, message);
|
||||
System.Diagnostics.Contracts.Contract.Assert(cond,'Файл '+sourceFile+', строка '+line.ToString())
|
||||
System.Diagnostics.Contracts.Contract.Assert(cond,'Файл '+sourceFile+', строка '+line.ToString() + ': ' + message)
|
||||
end;
|
||||
|
||||
function DiskFree(diskname: string): int64;
|
||||
|
|
@ -6963,6 +7013,8 @@ function Power(x: BigInteger; y: integer) := BigInteger.Pow(x, y);
|
|||
|
||||
function Round(x: real) := Convert.ToInt32(Math.Round(x));
|
||||
|
||||
function Round(x: real; digits: integer) := Math.Round(x,digits);
|
||||
|
||||
function RoundBigInteger(x: real) := BigInteger.Create(Math.Round(x));
|
||||
|
||||
function Trunc(x: real) := Convert.ToInt32(Math.Truncate(x));
|
||||
|
|
@ -7403,17 +7455,12 @@ end;
|
|||
|
||||
function Pos(subs, s: string; from: integer): integer;
|
||||
begin
|
||||
if (subs = nil) or (subs.Length = 0) then
|
||||
if (subs = nil) or (subs.Length = 0) or (from > s.Length) then
|
||||
Result := 0
|
||||
else Result := s.IndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
|
||||
function PosEx(subs, s: string; from: integer): integer;
|
||||
begin
|
||||
if (subs = nil) or (subs.Length = 0) then
|
||||
Result := 0
|
||||
else Result := s.IndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
function PosEx(subs, s: string; from: integer) := Pos(subs,s,from);
|
||||
|
||||
function LastPos(subs, s: string): integer;
|
||||
begin
|
||||
|
|
@ -7424,20 +7471,19 @@ end;
|
|||
|
||||
function LastPos(subs, s: string; from: integer): integer;
|
||||
begin
|
||||
if (subs = nil) or (subs.Length = 0) then
|
||||
if (subs = nil) or (subs.Length = 0) or (from > s.Length) then
|
||||
Result := 0
|
||||
else Result := s.LastIndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
|
||||
function Pos(c: char; s: string; from: integer): integer;
|
||||
{function Pos(c: char; s: string; from: integer): integer;
|
||||
begin
|
||||
if from > s.Length then
|
||||
Result := 0;
|
||||
Result := s.IndexOf(c, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
|
||||
function PosEx(c: char; s: string; from: integer): integer;
|
||||
begin
|
||||
Result := s.IndexOf(c, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
function PosEx(c: char; s: string; from: integer) := Pos(c,s,from);
|
||||
|
||||
function LastPos(c: char; s: string): integer;
|
||||
begin
|
||||
|
|
@ -7446,8 +7492,10 @@ end;
|
|||
|
||||
function LastPos(c: char; s: string; from: integer): integer;
|
||||
begin
|
||||
if from > s.Length then
|
||||
Result := 0;
|
||||
Result := s.LastIndexOf(c, from - 1, System.StringComparison.Ordinal) + 1;
|
||||
end;
|
||||
end;}
|
||||
|
||||
function Length(s: string): integer;
|
||||
begin
|
||||
|
|
@ -7478,7 +7526,7 @@ begin
|
|||
s := s.Substring(0, n)
|
||||
else if s.Length < n then
|
||||
if n <= sz then
|
||||
s += new string(' ', n - s.Length )
|
||||
s += new string(' ', n - s.Length)
|
||||
else
|
||||
s += new String(' ', sz - s.Length)
|
||||
end;
|
||||
|
|
@ -7491,12 +7539,6 @@ begin
|
|||
if index > s.Length + 1 then
|
||||
index := s.Length + 1;
|
||||
s := s.Insert(index - 1, source);
|
||||
{ try
|
||||
s := s.Insert(index - 1, source);
|
||||
except
|
||||
on e: System.Exception do
|
||||
s := s.Insert(s.Length, source);
|
||||
end;}
|
||||
end;
|
||||
|
||||
procedure InsertInShortString(source: string; var s: string; index, n: integer);
|
||||
|
|
@ -7537,14 +7579,6 @@ begin
|
|||
if index + count - 1 > s.Length then
|
||||
count := s.Length - index + 1;
|
||||
Result := s.SubString(index - 1, count);
|
||||
{ try
|
||||
if index - 1 >= s.Length then
|
||||
Result := ''
|
||||
else Result := s.SubString(index - 1, count);
|
||||
except
|
||||
on e: System.Exception do
|
||||
Result := s.Substring(index - 1, s.Length - index + 1);
|
||||
end;}
|
||||
end;
|
||||
|
||||
function Concat(s1, s2: string): string;
|
||||
|
|
@ -9952,6 +9986,12 @@ begin
|
|||
Result := Round(Self);
|
||||
end;
|
||||
|
||||
/// Возвращает x, округленное до ближайшего вещественного с digits знаками после десятичной точки
|
||||
function Round(Self: real; digits: integer): real; extensionmethod;
|
||||
begin
|
||||
Result := Round(Self,digits);
|
||||
end;
|
||||
|
||||
/// Возвращает число, округленное до ближайшего длинного целого
|
||||
function RoundBigInteger(Self: real): BigInteger; extensionmethod;
|
||||
begin
|
||||
|
|
@ -10358,9 +10398,21 @@ begin
|
|||
end;
|
||||
|
||||
///--
|
||||
function operator=<T1, T2> (Self: (T1,T2); v: (T1,T2)); extensionmethod := Object.ReferenceEquals(Self,nil) ? Object.ReferenceEquals(v,nil): Self.Equals(v);
|
||||
function InternalEqual<T1, T2> (x: (T1,T2); y: (T1,T2)): boolean;
|
||||
begin
|
||||
var xn := Object.ReferenceEquals(x,nil);
|
||||
var yn := Object.ReferenceEquals(y,nil);
|
||||
if xn then
|
||||
Result := yn
|
||||
else if yn then
|
||||
Result := xn
|
||||
else Result := x.Equals(y);
|
||||
end;
|
||||
|
||||
///--
|
||||
function operator<><T1, T2> (Self: (T1,T2); v: (T1,T2)); extensionmethod := not (Self = v);
|
||||
function operator=<T1, T2> (x: (T1,T2); y: (T1,T2)): boolean; extensionmethod := InternalEqual(x,y);
|
||||
///--
|
||||
function operator<><T1, T2> (x: (T1,T2); y: (T1,T2)): boolean; extensionmethod := not InternalEqual(x,y);
|
||||
///--
|
||||
function CompareToTup2<T1, T2>(v1: (T1, T2); v2: (T1, T2)) := (v1 as System.IComparable).CompareTo(v2);
|
||||
///--
|
||||
|
|
@ -10373,9 +10425,20 @@ function operator><T1, T2>(Self: (T1, T2); v: (T1, T2)); extensionmethod := Comp
|
|||
function operator>=<T1, T2>(Self: (T1, T2); v: (T1, T2)); extensionmethod := CompareToTup2(Self, v) >= 0;
|
||||
|
||||
///--
|
||||
function operator=<T1, T2, T3> (Self: (T1,T2,T3); v: (T1,T2,T3)); extensionmethod := Object.ReferenceEquals(Self,nil) ? Object.ReferenceEquals(v,nil): Self.Equals(v);
|
||||
function InternalEqual<T1, T2, T3> (x: (T1,T2,T3); y: (T1,T2,T3)): boolean;
|
||||
begin
|
||||
var xn := Object.ReferenceEquals(x,nil);
|
||||
var yn := Object.ReferenceEquals(y,nil);
|
||||
if xn then
|
||||
Result := yn
|
||||
else if yn then
|
||||
Result := xn
|
||||
else Result := x.Equals(y);
|
||||
end;
|
||||
///--
|
||||
function operator<><T1, T2, T3> (Self: (T1,T2,T3); v: (T1,T2,T3)); extensionmethod := not (Self = v);
|
||||
function operator=<T1, T2, T3> (x: (T1,T2,T3); y: (T1,T2,T3)); extensionmethod := InternalEqual(x,y);
|
||||
///--
|
||||
function operator<><T1, T2, T3> (x: (T1,T2,T3); y: (T1,T2,T3)); extensionmethod := not InternalEqual(x,y);
|
||||
///--
|
||||
function CompareToTup3<T1, T2, T3>(v1: (T1, T2, T3); v2: (T1, T2, T3)) := (v1 as System.IComparable).CompareTo(v2);
|
||||
///--
|
||||
|
|
@ -10388,9 +10451,20 @@ function operator><T1,T2,T3>(Self: (T1, T2, T3); v: (T1, T2, T3)); extensionmeth
|
|||
function operator>=<T1,T2,T3>(Self: (T1, T2, T3); v: (T1, T2, T3)); extensionmethod := CompareToTup3(Self, v) >= 0;
|
||||
|
||||
///--
|
||||
function operator=<T1, T2, T3, T4> (Self: (T1,T2,T3,T4); v: (T1,T2,T3,T4)); extensionmethod := Object.ReferenceEquals(Self,nil) ? Object.ReferenceEquals(v,nil): Self.Equals(v);
|
||||
function InternalEqual<T1, T2, T3, T4> (x: (T1,T2,T3,T4); y: (T1,T2,T3,T4)): boolean;
|
||||
begin
|
||||
var xn := Object.ReferenceEquals(x,nil);
|
||||
var yn := Object.ReferenceEquals(y,nil);
|
||||
if xn then
|
||||
Result := yn
|
||||
else if yn then
|
||||
Result := xn
|
||||
else Result := x.Equals(y);
|
||||
end;
|
||||
///--
|
||||
function operator<><T1, T2, T3, T4> (Self: (T1,T2,T3,T4); v: (T1,T2,T3,T4)); extensionmethod := not (Self = v);
|
||||
function operator=<T1, T2, T3, T4> (x: (T1,T2,T3,T4); y: (T1,T2,T3,T4)); extensionmethod := InternalEqual(x,y);
|
||||
///--
|
||||
function operator<><T1, T2, T3, T4> (x: (T1,T2,T3,T4); y: (T1,T2,T3,T4)); extensionmethod := not InternalEqual(x,y);
|
||||
///--
|
||||
function CompareToTup4<T1, T2, T3, T4>(v1: (T1, T2, T3, T4); v2: (T1, T2, T3, T4)) := (v1 as System.IComparable).CompareTo(v2);
|
||||
///--
|
||||
|
|
@ -10402,7 +10476,83 @@ function operator><T1,T2,T3,T4>(Self: (T1, T2, T3, T4); v: (T1, T2, T3, T4)); ex
|
|||
///--
|
||||
function operator>=<T1,T2,T3,T4>(Self: (T1, T2, T3, T4); v: (T1, T2, T3, T4)); extensionmethod := CompareToTup4(Self, v) >= 0;
|
||||
|
||||
///--
|
||||
function InternalEqual<T1, T2, T3, T4, T5> (x: (T1,T2,T3,T4,T5); y: (T1,T2,T3,T4,T5)): boolean;
|
||||
begin
|
||||
var xn := Object.ReferenceEquals(x,nil);
|
||||
var yn := Object.ReferenceEquals(y,nil);
|
||||
if xn then
|
||||
Result := yn
|
||||
else if yn then
|
||||
Result := xn
|
||||
else Result := x.Equals(y);
|
||||
end;
|
||||
///--
|
||||
function operator=<T1, T2, T3, T4,T5> (x: (T1,T2,T3,T4,T5); y: (T1,T2,T3,T4,T5)); extensionmethod := InternalEqual(x,y);
|
||||
///--
|
||||
function operator<><T1, T2, T3, T4,T5> (x: (T1,T2,T3,T4,T5); y: (T1,T2,T3,T4,T5)); extensionmethod := not InternalEqual(x,y);
|
||||
///--
|
||||
function CompareToTup5<T1, T2, T3, T4,T5>(v1: (T1, T2, T3, T4,T5); v2: (T1, T2, T3, T4,T5)) := (v1 as System.IComparable).CompareTo(v2);
|
||||
///--
|
||||
function operator<<T1,T2,T3,T4,T5>(Self: (T1, T2, T3, T4,T5); v: (T1, T2, T3, T4,T5)); extensionmethod := CompareToTup5(Self, v) < 0;
|
||||
///--
|
||||
function operator<=<T1,T2,T3,T4,T5>(Self: (T1, T2, T3, T4,T5); v: (T1, T2, T3, T4,T5)); extensionmethod := CompareToTup5(Self, v) <= 0;
|
||||
///--
|
||||
function operator><T1,T2,T3,T4,T5>(Self: (T1, T2, T3, T4,T5); v: (T1, T2, T3, T4,T5)); extensionmethod := CompareToTup5(Self, v) > 0;
|
||||
///--
|
||||
function operator>=<T1,T2,T3,T4,T5>(Self: (T1, T2, T3, T4,T5); v: (T1, T2, T3, T4,T5)); extensionmethod := CompareToTup5(Self, v) >= 0;
|
||||
|
||||
///--
|
||||
function InternalEqual<T1, T2, T3, T4, T5, T6> (x: (T1,T2,T3,T4,T5,T6); y: (T1,T2,T3,T4,T5,T6)): boolean;
|
||||
begin
|
||||
var xn := Object.ReferenceEquals(x,nil);
|
||||
var yn := Object.ReferenceEquals(y,nil);
|
||||
if xn then
|
||||
Result := yn
|
||||
else if yn then
|
||||
Result := xn
|
||||
else Result := x.Equals(y);
|
||||
end;
|
||||
///--
|
||||
function operator=<T1, T2, T3, T4,T5,T6> (x: (T1,T2,T3,T4,T5,T6); y: (T1,T2,T3,T4,T5,T6)); extensionmethod := InternalEqual(x,y);
|
||||
///--
|
||||
function operator<><T1, T2, T3, T4,T5,T6> (x: (T1,T2,T3,T4,T5,T6); y: (T1,T2,T3,T4,T5,T6)); extensionmethod := not InternalEqual(x,y);
|
||||
///--
|
||||
function CompareToTup5<T1, T2, T3, T4,T5,T6>(v1: (T1, T2, T3, T4,T5,T6); v2: (T1, T2, T3, T4,T5,T6)) := (v1 as System.IComparable).CompareTo(v2);
|
||||
///--
|
||||
function operator<<T1,T2,T3,T4,T5,T6>(Self: (T1, T2, T3, T4,T5,T6); v: (T1, T2, T3, T4,T5,T6)); extensionmethod := CompareToTup5(Self, v) < 0;
|
||||
///--
|
||||
function operator<=<T1,T2,T3,T4,T5,T6>(Self: (T1, T2, T3, T4,T5,T6); v: (T1, T2, T3, T4,T5,T6)); extensionmethod := CompareToTup5(Self, v) <= 0;
|
||||
///--
|
||||
function operator><T1,T2,T3,T4,T5,T6>(Self: (T1, T2, T3, T4,T5,T6); v: (T1, T2, T3, T4,T5,T6)); extensionmethod := CompareToTup5(Self, v) > 0;
|
||||
///--
|
||||
function operator>=<T1,T2,T3,T4,T5,T6>(Self: (T1, T2, T3, T4,T5,T6); v: (T1, T2, T3, T4,T5,T6)); extensionmethod := CompareToTup5(Self, v) >= 0;
|
||||
|
||||
///--
|
||||
function InternalEqual<T1, T2, T3, T4, T5, T6, T7> (x: (T1,T2,T3,T4,T5,T6,T7); y: (T1,T2,T3,T4,T5,T6,T7)): boolean;
|
||||
begin
|
||||
var xn := Object.ReferenceEquals(x,nil);
|
||||
var yn := Object.ReferenceEquals(y,nil);
|
||||
if xn then
|
||||
Result := yn
|
||||
else if yn then
|
||||
Result := xn
|
||||
else Result := x.Equals(y);
|
||||
end;
|
||||
///--
|
||||
function operator=<T1, T2, T3, T4,T5,T6,T7> (x: (T1,T2,T3,T4,T5,T6,T7); y: (T1,T2,T3,T4,T5,T6,T7)); extensionmethod := InternalEqual(x,y);
|
||||
///--
|
||||
function operator<><T1, T2, T3, T4,T5,T6,T7> (x: (T1,T2,T3,T4,T5,T6,T7); y: (T1,T2,T3,T4,T5,T6,T7)); extensionmethod := not InternalEqual(x,y);
|
||||
///--
|
||||
function CompareToTup5<T1, T2, T3, T4,T5,T6,T7>(v1: (T1, T2, T3, T4,T5,T6,T7); v2: (T1, T2, T3, T4,T5,T6,T7)) := (v1 as System.IComparable).CompareTo(v2);
|
||||
///--
|
||||
function operator<<T1,T2,T3,T4,T5,T6,T7>(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1, T2, T3, T4,T5,T6,T7)); extensionmethod := CompareToTup5(Self, v) < 0;
|
||||
///--
|
||||
function operator<=<T1,T2,T3,T4,T5,T6,T7>(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1, T2, T3, T4,T5,T6,T7)); extensionmethod := CompareToTup5(Self, v) <= 0;
|
||||
///--
|
||||
function operator><T1,T2,T3,T4,T5,T6,T7>(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1, T2, T3, T4,T5,T6,T7)); extensionmethod := CompareToTup5(Self, v) > 0;
|
||||
///--
|
||||
function operator>=<T1,T2,T3,T4,T5,T6,T7>(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1, T2, T3, T4,T5,T6,T7)); extensionmethod := CompareToTup5(Self, v) >= 0;
|
||||
// --------------------------------------------
|
||||
// Методы расширения типа Tuple # Extension methods for Tuple
|
||||
// -------------------------------------------
|
||||
|
|
|
|||
|
|
@ -63,4 +63,5 @@ ONLY_BASE_ASSIGNMENT_FOR_TUPLE=Tuple allows only base assignment :=
|
|||
BAD_FORMAT_STRING=Interpolated string has invalid format
|
||||
TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7=Count of Tuple elements must be <=7
|
||||
TWO_NILS_IN_QUESTION_EXPR=The conditional expression cannot contain nil constants on both branches
|
||||
DOT_QUECTION_IN_SHORT_FUN=Expression with ?. cannot appear in a short function definition without a return value
|
||||
DOT_QUECTION_IN_SHORT_FUN=Expression with ?. cannot appear in a short function definition without a return value
|
||||
BAD_INT2=Too small int64
|
||||
|
|
@ -62,4 +62,5 @@ ONLY_BASE_ASSIGNMENT_FOR_TUPLE=Для кортежа допустимо толь
|
|||
BAD_FORMAT_STRING=Встречена неправильная форматная строка
|
||||
TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7=Количество элементов кортежа не должно быть больше 7
|
||||
TWO_NILS_IN_QUESTION_EXPR=Условное выражение не может содержать константы nil по обеим веткам
|
||||
DOT_QUECTION_IN_SHORT_FUN=Выражение с ?. не может фигурировать в коротком определении функции без возвращаемого значения
|
||||
DOT_QUECTION_IN_SHORT_FUN=Выражение с ?. не может фигурировать в коротком определении функции без возвращаемого значения
|
||||
BAD_INT2=Слишком маленькое целое
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue