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 Minor = "6";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "2340";
|
||||
public const string Revision = "2344";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=0
|
||||
%REVISION%=2340
|
||||
%REVISION%=2344
|
||||
%MINOR%=6
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -534,8 +534,12 @@ namespace PascalABCCompiler.NETGenerator
|
|||
|
||||
cur_unit = Path.GetFileNameWithoutExtension(SourceFileName);
|
||||
string entry_cur_unit = cur_unit;
|
||||
entry_type = mb.DefineType(cur_unit + ".Program", TypeAttributes.Public);//определяем синтетический статический класс основной программы
|
||||
cur_type = entry_type;
|
||||
// SSM 07.02.20
|
||||
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)
|
||||
{
|
||||
|
|
@ -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];
|
||||
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];
|
||||
cur_type = entry_type;
|
||||
// SSM 07.02.20
|
||||
if (entry_type != null)
|
||||
cur_type = entry_type;
|
||||
if (!is_main_namespace)
|
||||
{
|
||||
cur_unit = cnn.namespace_name; // SSM 05.02.20 here change
|
||||
|
|
@ -644,7 +650,9 @@ namespace PascalABCCompiler.NETGenerator
|
|||
}
|
||||
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;
|
||||
}
|
||||
cur_type = entry_type;
|
||||
// SSM 07.02.20
|
||||
if (entry_type != null)
|
||||
cur_type = entry_type;
|
||||
//is_in_unit = false;
|
||||
//переводим реализации
|
||||
for (int iii = 0; iii < cnns.Length; iii++)
|
||||
|
|
@ -841,10 +851,13 @@ namespace PascalABCCompiler.NETGenerator
|
|||
MakeAttribute(cnns[iii]);
|
||||
}
|
||||
doc = first_doc;
|
||||
cur_type = entry_type;
|
||||
// SSM 07.02.20
|
||||
if (entry_type != null)
|
||||
cur_type = entry_type;
|
||||
|
||||
CloseTypes();//закрываем типы
|
||||
entry_type.CreateType();
|
||||
// SSM 07.02.20 ?
|
||||
entry_type?.CreateType();
|
||||
switch (comp_opt.target)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
entry_type.SetCustomAttribute(attr_ci, bytes);
|
||||
// SSM 07.02.20 ?
|
||||
entry_type?.SetCustomAttribute(attr_ci, bytes);
|
||||
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: single);
|
||||
procedure read(var x: boolean);
|
||||
procedure read(var x: BigInteger);
|
||||
procedure readln;
|
||||
function ReadLine: string;
|
||||
function ReadLexem: string;
|
||||
|
|
@ -341,6 +342,7 @@ type
|
|||
procedure read(var x: uint64); virtual;
|
||||
procedure read(var x: single); virtual;
|
||||
procedure read(var x: boolean); virtual;
|
||||
procedure read(var x: BigInteger); virtual;
|
||||
procedure readln; virtual;
|
||||
function ReadLine: string; virtual;
|
||||
function ReadLexem: string; virtual;
|
||||
|
|
@ -618,6 +620,8 @@ procedure Read(var x: uint64);
|
|||
procedure Read(var x: single);
|
||||
///--
|
||||
procedure Read(var x: boolean);
|
||||
///--
|
||||
procedure Read(var x: BigInteger);
|
||||
///- procedure Readln(a,b,...);
|
||||
/// Вводит значения a,b,... с клавиатуры и осуществляет переход на следующую строку
|
||||
procedure Readln;
|
||||
|
|
@ -642,6 +646,8 @@ function TryRead(var x: int64): boolean;
|
|||
function TryRead(var x: uint64): boolean;
|
||||
///--
|
||||
function TryRead(var x: single): boolean;
|
||||
///--
|
||||
function TryRead(var x: BigInteger): boolean;
|
||||
|
||||
/// Возвращает значение типа integer, введенное с клавиатуры
|
||||
function ReadInteger: integer;
|
||||
|
|
@ -655,6 +661,8 @@ function ReadChar: char;
|
|||
function ReadString: string;
|
||||
/// Возвращает значение типа boolean, введенное с клавиатуры
|
||||
function ReadBoolean: boolean;
|
||||
/// Возвращает значение типа BigInteger, введенное с клавиатуры
|
||||
function ReadBigInteger: BigInteger;
|
||||
/// Возвращает следующую лексему
|
||||
function ReadLexem: string;
|
||||
|
||||
|
|
@ -670,6 +678,9 @@ function ReadlnChar: char;
|
|||
function ReadlnString: string;
|
||||
/// Возвращает значение типа boolean, введенное с клавиатуры, и переходит на следующую строку ввода
|
||||
function ReadlnBoolean: boolean;
|
||||
/// Возвращает значение типа BigInteger, введенное с клавиатуры, и переходит на следующую строку ввода
|
||||
function ReadlnBigInteger: BigInteger;
|
||||
|
||||
|
||||
/// Возвращает кортеж из двух значений типа integer, введенных с клавиатуры
|
||||
function ReadInteger2: (integer, integer);
|
||||
|
|
@ -2344,7 +2355,7 @@ type
|
|||
end;
|
||||
|
||||
|
||||
type
|
||||
{type
|
||||
///--
|
||||
__TypeclassRestrictedFunctionAttribute = class(Attribute)
|
||||
public
|
||||
|
|
@ -2384,7 +2395,7 @@ type
|
|||
constructor(instanceName: string);
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
end;}
|
||||
|
||||
type
|
||||
// Смысл полей 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;
|
||||
|
||||
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 mod(p,q: BigInteger) := BigInteger.Remainder(p,q);
|
||||
|
|
@ -5232,6 +5247,11 @@ begin
|
|||
else raise new System.FormatException('Входная строка имела неверный формат');
|
||||
end;
|
||||
|
||||
procedure IOStandardSystem.read(var x: BigInteger);
|
||||
begin
|
||||
x := Biginteger.Parse(ReadLexem)
|
||||
end;
|
||||
|
||||
procedure IOStandardSystem.readln;
|
||||
begin
|
||||
// while CurrentIOSystem.read_symbol <> END_OF_LINE_SYMBOL do; // было
|
||||
|
|
@ -5360,6 +5380,11 @@ begin
|
|||
CurrentIOSystem.read(x)
|
||||
end;
|
||||
|
||||
procedure Read(var x: BigInteger);
|
||||
begin
|
||||
CurrentIOSystem.read(x)
|
||||
end;
|
||||
|
||||
function TryRead(var x: integer): boolean;
|
||||
begin
|
||||
Result := True;
|
||||
|
|
@ -5370,6 +5395,16 @@ begin
|
|||
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;
|
||||
begin
|
||||
Result := True;
|
||||
|
|
@ -5490,6 +5525,11 @@ begin
|
|||
Read(Result);
|
||||
end;
|
||||
|
||||
function ReadBigInteger: BigInteger;
|
||||
begin
|
||||
Read(Result);
|
||||
end;
|
||||
|
||||
function ReadlnInteger: integer;
|
||||
begin
|
||||
Result := ReadInteger;
|
||||
|
|
@ -5525,6 +5565,13 @@ begin
|
|||
Readln();
|
||||
end;
|
||||
|
||||
function ReadlnBigInteger: BigInteger;
|
||||
begin
|
||||
Result := ReadBigInteger;
|
||||
Readln();
|
||||
end;
|
||||
|
||||
|
||||
function ReadInteger2 := (ReadInteger, ReadInteger);
|
||||
|
||||
function ReadReal2 := (ReadReal, ReadReal);
|
||||
|
|
@ -11537,6 +11584,11 @@ begin
|
|||
Result := Self.ToDictionary(g -> g.Key, g -> grOperation(g));
|
||||
end;
|
||||
|
||||
/// Операция удаления из словаря пары с указанным значением ключа
|
||||
procedure operator-=<Key,Value>(Self: IDictionary<Key,Value>; k: Key); extensionmethod;
|
||||
begin
|
||||
Self.Remove(k);
|
||||
end;
|
||||
|
||||
//{{{--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-типе.
|
||||
if (method_param_types == (t.DeclaringMethod != null))
|
||||
{
|
||||
return param_types[t.GenericParameterPosition];
|
||||
try
|
||||
{
|
||||
return param_types[t.GenericParameterPosition];
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e = e;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2355,7 +2355,7 @@ type
|
|||
end;
|
||||
|
||||
|
||||
type
|
||||
{type
|
||||
///--
|
||||
__TypeclassRestrictedFunctionAttribute = class(Attribute)
|
||||
public
|
||||
|
|
@ -2395,7 +2395,7 @@ type
|
|||
constructor(instanceName: string);
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
end;}
|
||||
|
||||
type
|
||||
// Смысл полей 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;
|
||||
|
||||
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 mod(p,q: BigInteger) := BigInteger.Remainder(p,q);
|
||||
|
|
@ -11580,6 +11584,11 @@ begin
|
|||
Result := Self.ToDictionary(g -> g.Key, g -> grOperation(g));
|
||||
end;
|
||||
|
||||
/// Операция удаления из словаря пары с указанным значением ключа
|
||||
procedure operator-=<Key,Value>(Self: IDictionary<Key,Value>; k: Key); extensionmethod;
|
||||
begin
|
||||
Self.Remove(k);
|
||||
end;
|
||||
|
||||
//{{{--doc: Конец методов расширения }}}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,36 @@ function RlnR3 := ReadlnReal3;
|
|||
function RlnC3 := ReadlnChar3;
|
||||
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.
|
||||
Loading…
Reference in a new issue