MAP -= KEY
This commit is contained in:
parent
55abbf316b
commit
454001cba9
|
|
@ -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 = "0";
|
public const string Build = "0";
|
||||||
public const string Revision = "2340";
|
public const string Revision = "2344";
|
||||||
|
|
||||||
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 @@
|
||||||
%COREVERSION%=0
|
%COREVERSION%=0
|
||||||
%REVISION%=2340
|
%REVISION%=2344
|
||||||
%MINOR%=6
|
%MINOR%=6
|
||||||
%MAJOR%=3
|
%MAJOR%=3
|
||||||
|
|
|
||||||
|
|
@ -534,8 +534,12 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
|
|
||||||
cur_unit = Path.GetFileNameWithoutExtension(SourceFileName);
|
cur_unit = Path.GetFileNameWithoutExtension(SourceFileName);
|
||||||
string entry_cur_unit = cur_unit;
|
string entry_cur_unit = cur_unit;
|
||||||
entry_type = mb.DefineType(cur_unit + ".Program", TypeAttributes.Public);//определяем синтетический статический класс основной программы
|
// SSM 07.02.20
|
||||||
cur_type = entry_type;
|
if (comp_opt.target != TargetType.Dll)
|
||||||
|
entry_type = mb.DefineType(cur_unit + ".Program", TypeAttributes.Public);//определяем синтетический статический класс основной программы
|
||||||
|
// SSM 07.02.20
|
||||||
|
if (entry_type != null)
|
||||||
|
cur_type = entry_type;
|
||||||
//точка входа в приложение
|
//точка входа в приложение
|
||||||
if (p.main_function != null)
|
if (p.main_function != null)
|
||||||
{
|
{
|
||||||
|
|
@ -591,7 +595,9 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
if (save_debug_info) doc = sym_docs[cnns[iii].Location == null ? SourceFileName : cnns[iii].Location.document.file_name];
|
if (save_debug_info) doc = sym_docs[cnns[iii].Location == null ? SourceFileName : cnns[iii].Location.document.file_name];
|
||||||
bool is_main_namespace = cnns[iii].namespace_name == "" && comp_opt.target != TargetType.Dll || comp_opt.target == TargetType.Dll && cnns[iii].namespace_name == "";
|
bool is_main_namespace = cnns[iii].namespace_name == "" && comp_opt.target != TargetType.Dll || comp_opt.target == TargetType.Dll && cnns[iii].namespace_name == "";
|
||||||
ICommonNamespaceNode cnn = cnns[iii];
|
ICommonNamespaceNode cnn = cnns[iii];
|
||||||
cur_type = entry_type;
|
// SSM 07.02.20
|
||||||
|
if (entry_type != null)
|
||||||
|
cur_type = entry_type;
|
||||||
if (!is_main_namespace)
|
if (!is_main_namespace)
|
||||||
{
|
{
|
||||||
cur_unit = cnn.namespace_name; // SSM 05.02.20 here change
|
cur_unit = cnn.namespace_name; // SSM 05.02.20 here change
|
||||||
|
|
@ -644,7 +650,9 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NamespacesTypes.Add(cnns[iii], entry_type);
|
// SSM 07.02.20
|
||||||
|
if (entry_type != null)
|
||||||
|
NamespacesTypes.Add(cnns[iii], entry_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -798,7 +806,9 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
}
|
}
|
||||||
il = tmp_il;
|
il = tmp_il;
|
||||||
}
|
}
|
||||||
cur_type = entry_type;
|
// SSM 07.02.20
|
||||||
|
if (entry_type != null)
|
||||||
|
cur_type = entry_type;
|
||||||
//is_in_unit = false;
|
//is_in_unit = false;
|
||||||
//переводим реализации
|
//переводим реализации
|
||||||
for (int iii = 0; iii < cnns.Length; iii++)
|
for (int iii = 0; iii < cnns.Length; iii++)
|
||||||
|
|
@ -841,10 +851,13 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
MakeAttribute(cnns[iii]);
|
MakeAttribute(cnns[iii]);
|
||||||
}
|
}
|
||||||
doc = first_doc;
|
doc = first_doc;
|
||||||
cur_type = entry_type;
|
// SSM 07.02.20
|
||||||
|
if (entry_type != null)
|
||||||
|
cur_type = entry_type;
|
||||||
|
|
||||||
CloseTypes();//закрываем типы
|
CloseTypes();//закрываем типы
|
||||||
entry_type.CreateType();
|
// SSM 07.02.20 ?
|
||||||
|
entry_type?.CreateType();
|
||||||
switch (comp_opt.target)
|
switch (comp_opt.target)
|
||||||
{
|
{
|
||||||
case TargetType.Exe: ab.SetEntryPoint(entry_meth, PEFileKinds.ConsoleApplication); break;
|
case TargetType.Exe: ab.SetEntryPoint(entry_meth, PEFileKinds.ConsoleApplication); break;
|
||||||
|
|
@ -909,7 +922,8 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
bytes[6] = (byte)(0x80 | ((sb.Length & 0xFF00) >> 8));
|
bytes[6] = (byte)(0x80 | ((sb.Length & 0xFF00) >> 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entry_type.SetCustomAttribute(attr_ci, bytes);
|
// SSM 07.02.20 ?
|
||||||
|
entry_type?.SetCustomAttribute(attr_ci, bytes);
|
||||||
attr_class.CreateType();
|
attr_class.CreateType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
3.6.0.2340
|
3.6.0.2344
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
!define VERSION '3.6.0.2340'
|
!define VERSION '3.6.0.2344'
|
||||||
|
|
|
||||||
6
TestSuite/BigIntegerDivMod.pas
Normal file
6
TestSuite/BigIntegerDivMod.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
begin
|
||||||
|
var a: BigInteger := 11;
|
||||||
|
Assert(a div 2 = 5);
|
||||||
|
Assert(a mod 2 = 1);
|
||||||
|
Assert(a mod BigInteger(2) = 1);
|
||||||
|
end.
|
||||||
|
|
@ -307,6 +307,7 @@ type
|
||||||
procedure read(var x: uint64);
|
procedure read(var x: uint64);
|
||||||
procedure read(var x: single);
|
procedure read(var x: single);
|
||||||
procedure read(var x: boolean);
|
procedure read(var x: boolean);
|
||||||
|
procedure read(var x: BigInteger);
|
||||||
procedure readln;
|
procedure readln;
|
||||||
function ReadLine: string;
|
function ReadLine: string;
|
||||||
function ReadLexem: string;
|
function ReadLexem: string;
|
||||||
|
|
@ -341,6 +342,7 @@ type
|
||||||
procedure read(var x: uint64); virtual;
|
procedure read(var x: uint64); virtual;
|
||||||
procedure read(var x: single); virtual;
|
procedure read(var x: single); virtual;
|
||||||
procedure read(var x: boolean); virtual;
|
procedure read(var x: boolean); virtual;
|
||||||
|
procedure read(var x: BigInteger); virtual;
|
||||||
procedure readln; virtual;
|
procedure readln; virtual;
|
||||||
function ReadLine: string; virtual;
|
function ReadLine: string; virtual;
|
||||||
function ReadLexem: string; virtual;
|
function ReadLexem: string; virtual;
|
||||||
|
|
@ -618,6 +620,8 @@ procedure Read(var x: uint64);
|
||||||
procedure Read(var x: single);
|
procedure Read(var x: single);
|
||||||
///--
|
///--
|
||||||
procedure Read(var x: boolean);
|
procedure Read(var x: boolean);
|
||||||
|
///--
|
||||||
|
procedure Read(var x: BigInteger);
|
||||||
///- procedure Readln(a,b,...);
|
///- procedure Readln(a,b,...);
|
||||||
/// Вводит значения a,b,... с клавиатуры и осуществляет переход на следующую строку
|
/// Вводит значения a,b,... с клавиатуры и осуществляет переход на следующую строку
|
||||||
procedure Readln;
|
procedure Readln;
|
||||||
|
|
@ -642,6 +646,8 @@ function TryRead(var x: int64): boolean;
|
||||||
function TryRead(var x: uint64): boolean;
|
function TryRead(var x: uint64): boolean;
|
||||||
///--
|
///--
|
||||||
function TryRead(var x: single): boolean;
|
function TryRead(var x: single): boolean;
|
||||||
|
///--
|
||||||
|
function TryRead(var x: BigInteger): boolean;
|
||||||
|
|
||||||
/// Возвращает значение типа integer, введенное с клавиатуры
|
/// Возвращает значение типа integer, введенное с клавиатуры
|
||||||
function ReadInteger: integer;
|
function ReadInteger: integer;
|
||||||
|
|
@ -655,6 +661,8 @@ function ReadChar: char;
|
||||||
function ReadString: string;
|
function ReadString: string;
|
||||||
/// Возвращает значение типа boolean, введенное с клавиатуры
|
/// Возвращает значение типа boolean, введенное с клавиатуры
|
||||||
function ReadBoolean: boolean;
|
function ReadBoolean: boolean;
|
||||||
|
/// Возвращает значение типа BigInteger, введенное с клавиатуры
|
||||||
|
function ReadBigInteger: BigInteger;
|
||||||
/// Возвращает следующую лексему
|
/// Возвращает следующую лексему
|
||||||
function ReadLexem: string;
|
function ReadLexem: string;
|
||||||
|
|
||||||
|
|
@ -670,6 +678,9 @@ function ReadlnChar: char;
|
||||||
function ReadlnString: string;
|
function ReadlnString: string;
|
||||||
/// Возвращает значение типа boolean, введенное с клавиатуры, и переходит на следующую строку ввода
|
/// Возвращает значение типа boolean, введенное с клавиатуры, и переходит на следующую строку ввода
|
||||||
function ReadlnBoolean: boolean;
|
function ReadlnBoolean: boolean;
|
||||||
|
/// Возвращает значение типа BigInteger, введенное с клавиатуры, и переходит на следующую строку ввода
|
||||||
|
function ReadlnBigInteger: BigInteger;
|
||||||
|
|
||||||
|
|
||||||
/// Возвращает кортеж из двух значений типа integer, введенных с клавиатуры
|
/// Возвращает кортеж из двух значений типа integer, введенных с клавиатуры
|
||||||
function ReadInteger2: (integer, integer);
|
function ReadInteger2: (integer, integer);
|
||||||
|
|
@ -2344,7 +2355,7 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
type
|
{type
|
||||||
///--
|
///--
|
||||||
__TypeclassRestrictedFunctionAttribute = class(Attribute)
|
__TypeclassRestrictedFunctionAttribute = class(Attribute)
|
||||||
public
|
public
|
||||||
|
|
@ -2384,7 +2395,7 @@ type
|
||||||
constructor(instanceName: string);
|
constructor(instanceName: string);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;}
|
||||||
|
|
||||||
type
|
type
|
||||||
// Смысл полей Num, Width и Fmt соответствует
|
// Смысл полей Num, Width и Fmt соответствует
|
||||||
|
|
@ -4114,6 +4125,10 @@ procedure BigInteger.operator*=(var p: BigInteger; q: BigInteger) := p := p * q;
|
||||||
|
|
||||||
procedure BigInteger.operator-=(var p: BigInteger; q: BigInteger) := p := p - q;
|
procedure BigInteger.operator-=(var p: BigInteger; q: BigInteger) := p := p - q;
|
||||||
|
|
||||||
|
function BigInteger.operator div(p: BigInteger; q: integer) := BigInteger.Divide(p,q);
|
||||||
|
|
||||||
|
function BigInteger.operator mod(p: BigInteger; q: integer) := BigInteger.Remainder(p,q);
|
||||||
|
|
||||||
//function BigInteger.operator div(p,q: BigInteger) := BigInteger.Divide(p,q);
|
//function BigInteger.operator div(p,q: BigInteger) := BigInteger.Divide(p,q);
|
||||||
|
|
||||||
//function BigInteger.operator mod(p,q: BigInteger) := BigInteger.Remainder(p,q);
|
//function BigInteger.operator mod(p,q: BigInteger) := BigInteger.Remainder(p,q);
|
||||||
|
|
@ -5232,6 +5247,11 @@ begin
|
||||||
else raise new System.FormatException('Входная строка имела неверный формат');
|
else raise new System.FormatException('Входная строка имела неверный формат');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure IOStandardSystem.read(var x: BigInteger);
|
||||||
|
begin
|
||||||
|
x := Biginteger.Parse(ReadLexem)
|
||||||
|
end;
|
||||||
|
|
||||||
procedure IOStandardSystem.readln;
|
procedure IOStandardSystem.readln;
|
||||||
begin
|
begin
|
||||||
// while CurrentIOSystem.read_symbol <> END_OF_LINE_SYMBOL do; // было
|
// while CurrentIOSystem.read_symbol <> END_OF_LINE_SYMBOL do; // было
|
||||||
|
|
@ -5360,6 +5380,11 @@ begin
|
||||||
CurrentIOSystem.read(x)
|
CurrentIOSystem.read(x)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure Read(var x: BigInteger);
|
||||||
|
begin
|
||||||
|
CurrentIOSystem.read(x)
|
||||||
|
end;
|
||||||
|
|
||||||
function TryRead(var x: integer): boolean;
|
function TryRead(var x: integer): boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
|
|
@ -5370,6 +5395,16 @@ begin
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TryRead(var x: BigInteger): boolean;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
try
|
||||||
|
Read(x)
|
||||||
|
except
|
||||||
|
Result := False;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
function TryRead(var x: real): boolean;
|
function TryRead(var x: real): boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
|
|
@ -5490,6 +5525,11 @@ begin
|
||||||
Read(Result);
|
Read(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ReadBigInteger: BigInteger;
|
||||||
|
begin
|
||||||
|
Read(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
function ReadlnInteger: integer;
|
function ReadlnInteger: integer;
|
||||||
begin
|
begin
|
||||||
Result := ReadInteger;
|
Result := ReadInteger;
|
||||||
|
|
@ -5525,6 +5565,13 @@ begin
|
||||||
Readln();
|
Readln();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ReadlnBigInteger: BigInteger;
|
||||||
|
begin
|
||||||
|
Result := ReadBigInteger;
|
||||||
|
Readln();
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function ReadInteger2 := (ReadInteger, ReadInteger);
|
function ReadInteger2 := (ReadInteger, ReadInteger);
|
||||||
|
|
||||||
function ReadReal2 := (ReadReal, ReadReal);
|
function ReadReal2 := (ReadReal, ReadReal);
|
||||||
|
|
@ -11537,6 +11584,11 @@ begin
|
||||||
Result := Self.ToDictionary(g -> g.Key, g -> grOperation(g));
|
Result := Self.ToDictionary(g -> g.Key, g -> grOperation(g));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
/// Операция удаления из словаря пары с указанным значением ключа
|
||||||
|
procedure operator-=<Key,Value>(Self: IDictionary<Key,Value>; k: Key); extensionmethod;
|
||||||
|
begin
|
||||||
|
Self.Remove(k);
|
||||||
|
end;
|
||||||
|
|
||||||
//{{{--doc: Конец методов расширения }}}
|
//{{{--doc: Конец методов расширения }}}
|
||||||
|
|
||||||
|
|
|
||||||
10
TestSuite/MapME.pas
Normal file
10
TestSuite/MapME.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{procedure operator-=<Key,Value>(Self: IDictionary<Key,Value>; k: Key); extensionmethod;
|
||||||
|
begin
|
||||||
|
Self.Remove(k);
|
||||||
|
end;}
|
||||||
|
|
||||||
|
begin
|
||||||
|
var d := Dict(KV(1,2),KV(2,3));
|
||||||
|
d -= 1; d -= 4;
|
||||||
|
Assert(d.Count = 1);
|
||||||
|
end.
|
||||||
|
|
@ -396,7 +396,14 @@ namespace PascalABCCompiler.TreeRealization
|
||||||
//generic-типе.
|
//generic-типе.
|
||||||
if (method_param_types == (t.DeclaringMethod != null))
|
if (method_param_types == (t.DeclaringMethod != null))
|
||||||
{
|
{
|
||||||
return param_types[t.GenericParameterPosition];
|
try
|
||||||
|
{
|
||||||
|
return param_types[t.GenericParameterPosition];
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e = e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2355,7 +2355,7 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
type
|
{type
|
||||||
///--
|
///--
|
||||||
__TypeclassRestrictedFunctionAttribute = class(Attribute)
|
__TypeclassRestrictedFunctionAttribute = class(Attribute)
|
||||||
public
|
public
|
||||||
|
|
@ -2395,7 +2395,7 @@ type
|
||||||
constructor(instanceName: string);
|
constructor(instanceName: string);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;}
|
||||||
|
|
||||||
type
|
type
|
||||||
// Смысл полей Num, Width и Fmt соответствует
|
// Смысл полей Num, Width и Fmt соответствует
|
||||||
|
|
@ -4125,6 +4125,10 @@ procedure BigInteger.operator*=(var p: BigInteger; q: BigInteger) := p := p * q;
|
||||||
|
|
||||||
procedure BigInteger.operator-=(var p: BigInteger; q: BigInteger) := p := p - q;
|
procedure BigInteger.operator-=(var p: BigInteger; q: BigInteger) := p := p - q;
|
||||||
|
|
||||||
|
function BigInteger.operator div(p: BigInteger; q: integer) := BigInteger.Divide(p,q);
|
||||||
|
|
||||||
|
function BigInteger.operator mod(p: BigInteger; q: integer) := BigInteger.Remainder(p,q);
|
||||||
|
|
||||||
//function BigInteger.operator div(p,q: BigInteger) := BigInteger.Divide(p,q);
|
//function BigInteger.operator div(p,q: BigInteger) := BigInteger.Divide(p,q);
|
||||||
|
|
||||||
//function BigInteger.operator mod(p,q: BigInteger) := BigInteger.Remainder(p,q);
|
//function BigInteger.operator mod(p,q: BigInteger) := BigInteger.Remainder(p,q);
|
||||||
|
|
@ -11580,6 +11584,11 @@ begin
|
||||||
Result := Self.ToDictionary(g -> g.Key, g -> grOperation(g));
|
Result := Self.ToDictionary(g -> g.Key, g -> grOperation(g));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
/// Операция удаления из словаря пары с указанным значением ключа
|
||||||
|
procedure operator-=<Key,Value>(Self: IDictionary<Key,Value>; k: Key); extensionmethod;
|
||||||
|
begin
|
||||||
|
Self.Remove(k);
|
||||||
|
end;
|
||||||
|
|
||||||
//{{{--doc: Конец методов расширения }}}
|
//{{{--doc: Конец методов расширения }}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,36 @@ function RlnR3 := ReadlnReal3;
|
||||||
function RlnC3 := ReadlnChar3;
|
function RlnC3 := ReadlnChar3;
|
||||||
function RlnS3 := ReadlnString3;
|
function RlnS3 := ReadlnString3;
|
||||||
|
|
||||||
|
procedure ReMin(var min: integer; x: integer);
|
||||||
|
begin
|
||||||
|
if x < min then
|
||||||
|
min := x
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ReMax(var max: integer; x: integer);
|
||||||
|
begin
|
||||||
|
if x > max then
|
||||||
|
max := x
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ReMin(var min: real; x: real);
|
||||||
|
begin
|
||||||
|
if x < min then
|
||||||
|
min := x
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ReMax(var max: real; x: real);
|
||||||
|
begin
|
||||||
|
if x > max then
|
||||||
|
max := x
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ToI(Self: string); extensionmethod := Self.ToInteger;
|
||||||
|
|
||||||
|
function ToR(Self: string); extensionmethod := Self.ToReal;
|
||||||
|
|
||||||
|
function operator-(c,c1: char): integer; extensionmethod := Ord(c) - Ord(c1);
|
||||||
|
|
||||||
|
function Len(Self: string): integer; extensionmethod := Self.Length;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
Loading…
Reference in a new issue