This commit is contained in:
Mikhalkovich Stanislav 2024-11-16 10:56:11 +03:00
parent 591d9ebe60
commit f8819665ba
8 changed files with 99 additions and 84 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3"; public const string Major = "3";
public const string Minor = "10"; public const string Minor = "10";
public const string Build = "0"; public const string Build = "0";
public const string Revision = "3565"; public const string Revision = "3569";
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;

View file

@ -1,4 +1,4 @@
%MINOR%=10 %MINOR%=10
%REVISION%=3565 %REVISION%=3569
%COREVERSION%=0 %COREVERSION%=0
%MAJOR%=3 %MAJOR%=3

View file

@ -1 +1 @@
3.10.0.3565 3.10.0.3569

View file

@ -1 +1 @@
!define VERSION '3.10.0.3565' !define VERSION '3.10.0.3569'

View file

@ -457,7 +457,7 @@ end;
// Важнейший для новых множеств !!! // Важнейший для новых множеств !!!
{procedure operator:=<T>(var Self: NewSet<T>; st: NewSet<T>); extensionmethod; {procedure operator:=<T>(var Self: NewSet<T>; st: NewSet<T>); extensionmethod;
begin begin
Self.hs := new HashSet<T>(st.hs); Self._hs := new HashSet<T>(st.hs);
end;} end;}
{procedure operator:=<T>(var Self: NewSet<T>; st: NewSetEmpty); extensionmethod; {procedure operator:=<T>(var Self: NewSet<T>; st: NewSetEmpty); extensionmethod;
@ -468,89 +468,89 @@ end;}
// Extension-методы для новых множеств // Extension-методы для новых множеств
function operator implicit(n: NewSet<integer>): NewSet<byte>; extensionmethod; function operator implicit(n: NewSet<integer>): NewSet<byte>; extensionmethod;
begin begin
foreach var x in n.hs do foreach var x in n._hs do
if (x >= byte.MinValue) and (x <= byte.MaxValue) then if (x >= byte.MinValue) and (x <= byte.MaxValue) then
Result.hs.Add(x) Result._hs.Add(x)
else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT)); else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT));
end; end;
function operator implicit(n: NewSet<integer>): NewSet<shortint>; extensionmethod; function operator implicit(n: NewSet<integer>): NewSet<shortint>; extensionmethod;
begin begin
foreach var x in n.hs do foreach var x in n._hs do
if (x >= shortint.MinValue) and (x <= shortint.MaxValue) then if (x >= shortint.MinValue) and (x <= shortint.MaxValue) then
Result.hs.Add(x) Result._hs.Add(x)
else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT)); else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT));
end; end;
function operator implicit(n: NewSet<integer>): NewSet<smallint>; extensionmethod; function operator implicit(n: NewSet<integer>): NewSet<smallint>; extensionmethod;
begin begin
foreach var x in n.hs do foreach var x in n._hs do
if (x >= smallint.MinValue) and (x <= smallint.MaxValue) then if (x >= smallint.MinValue) and (x <= smallint.MaxValue) then
Result.hs.Add(x) Result._hs.Add(x)
else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT)); else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT));
end; end;
function operator implicit(n: NewSet<integer>): NewSet<word>; extensionmethod; function operator implicit(n: NewSet<integer>): NewSet<word>; extensionmethod;
begin begin
foreach var x in n.hs do foreach var x in n._hs do
if (x >= word.MinValue) and (x <= word.MaxValue) then if (x >= word.MinValue) and (x <= word.MaxValue) then
Result.hs.Add(x) Result._hs.Add(x)
else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT)); else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT));
end; end;
function operator implicit(n: NewSet<integer>): NewSet<longword>; extensionmethod; function operator implicit(n: NewSet<integer>): NewSet<longword>; extensionmethod;
begin begin
foreach var x in n.hs do foreach var x in n._hs do
if (x >= longword.MinValue) and (x <= longword.MaxValue) then if (x >= longword.MinValue) and (x <= longword.MaxValue) then
Result.hs.Add(x) Result._hs.Add(x)
else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT)); else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT));
end; end;
function operator implicit(n: NewSet<integer>): NewSet<int64>; extensionmethod; function operator implicit(n: NewSet<integer>): NewSet<int64>; extensionmethod;
begin begin
foreach var x in n.hs do foreach var x in n._hs do
Result.hs.Add(x) Result._hs.Add(x)
end; end;
function operator implicit(n: NewSet<integer>): NewSet<uint64>; extensionmethod; function operator implicit(n: NewSet<integer>): NewSet<uint64>; extensionmethod;
begin begin
foreach var x in n.hs do foreach var x in n._hs do
if x >= 0 then if x >= 0 then
Result.hs.Add(x) Result._hs.Add(x)
else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT)); else raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT));
end; end;
function NSToInts(ns: NewSet<byte>) := ns.hs.Select(x -> integer(x)); function NSToInts(ns: NewSet<byte>) := ns._hs.Select(x -> integer(x));
function NSToInts(ns: NewSet<shortint>) := ns.hs.Select(x -> integer(x)); function NSToInts(ns: NewSet<shortint>) := ns._hs.Select(x -> integer(x));
function NSToInts(ns: NewSet<smallint>) := ns.hs.Select(x -> integer(x)); function NSToInts(ns: NewSet<smallint>) := ns._hs.Select(x -> integer(x));
function NSToInts(ns: NewSet<word>) := ns.hs.Select(x -> integer(x)); function NSToInts(ns: NewSet<word>) := ns._hs.Select(x -> integer(x));
//function NSToInts(ns: NewSet<longword>) := ns._hs.Select(x -> integer(x)); //function NSToInts(ns: NewSet<longword>) := ns._hs.Select(x -> integer(x));
//function NSToInts(ns: NewSet<int64>) := ns._hs.Select(x -> integer(x)); //function NSToInts(ns: NewSet<int64>) := ns._hs.Select(x -> integer(x));
function NSToInts64(ns: NewSet<byte>) := ns.hs.Select(x -> int64(x)); function NSToInts64(ns: NewSet<byte>) := ns._hs.Select(x -> int64(x));
function NSToInts64(ns: NewSet<integer>) := ns.hs.Select(x -> int64(x)); function NSToInts64(ns: NewSet<integer>) := ns._hs.Select(x -> int64(x));
function NSToBytes(ns: NewSet<integer>) := ns.hs.Select(x -> byte(x)); function NSToBytes(ns: NewSet<integer>) := ns._hs.Select(x -> byte(x));
function NSToBytes(ns: NewSet<int64>) := ns.hs.Select(x -> byte(x)); function NSToBytes(ns: NewSet<int64>) := ns._hs.Select(x -> byte(x));
// Надо set of integer со всеми // Надо set of integer со всеми
function operator=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.SetEquals(NSToInts(b)); function operator=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<byte>; b: NewSet<integer>): boolean; extensionmethod := b = a; function operator=(a: NewSet<byte>; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: NewSet<integer>; b: NewSet<shortint>); extensionmethod := a.hs.SetEquals(NSToInts(b)); function operator=(a: NewSet<integer>; b: NewSet<shortint>); extensionmethod := a._hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<shortint>; b: NewSet<integer>): boolean; extensionmethod := b = a; function operator=(a: NewSet<shortint>; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: NewSet<integer>; b: NewSet<smallint>); extensionmethod := a.hs.SetEquals(NSToInts(b)); function operator=(a: NewSet<integer>; b: NewSet<smallint>); extensionmethod := a._hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<smallint>; b: NewSet<integer>): boolean; extensionmethod := b = a; function operator=(a: NewSet<smallint>; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: NewSet<integer>; b: NewSet<word>); extensionmethod := a.hs.SetEquals(NSToInts(b)); function operator=(a: NewSet<integer>; b: NewSet<word>); extensionmethod := a._hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<word>; b: NewSet<integer>): boolean; extensionmethod := b = a; function operator=(a: NewSet<word>; b: NewSet<integer>): boolean; extensionmethod := b = a;
// В этом случае integer и longword не вкладываются друг в друга // В этом случае integer и longword не вкладываются друг в друга
function operator=(a: NewSet<integer>; b: NewSet<longword>): boolean; extensionmethod; function operator=(a: NewSet<integer>; b: NewSet<longword>): boolean; extensionmethod;
begin begin
var hsInt64: HashSet<int64>; var hsInt64: HashSet<int64>;
hsInt64 := new HashSet<int64>(b.hs.Select(x -> int64(x))); hsInt64 := new HashSet<int64>(b._hs.Select(x -> int64(x)));
Result := hsInt64.SetEquals(a.hs.Select(x -> int64(x))); Result := hsInt64.SetEquals(a._hs.Select(x -> int64(x)));
end; end;
function operator=(a: NewSet<longword>; b: NewSet<integer>): boolean; extensionmethod := b = a; function operator=(a: NewSet<longword>; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.SetEquals(NSToInts64(b)); function operator=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.SetEquals(NSToInts64(b));
function operator=(a: NewSet<integer>; b: NewSet<int64>): boolean; extensionmethod := b = a; function operator=(a: NewSet<integer>; b: NewSet<int64>): boolean; extensionmethod := b = a;
// Здесь оба типа нельзя расширить до общего типа, и есть проблема // Здесь оба типа нельзя расширить до общего типа, и есть проблема
@ -582,43 +582,43 @@ function operator<>(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := no
function operator<>(a: NewSet<integer>; b: NewSet<uint64>); extensionmethod := not(a = b); function operator<>(a: NewSet<integer>; b: NewSet<uint64>); extensionmethod := not(a = b);
function operator<>(a: NewSet<uint64>; b: NewSet<integer>); extensionmethod := not(a = b); function operator<>(a: NewSet<uint64>; b: NewSet<integer>); extensionmethod := not(a = b);
function operator<(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.IsProperSubsetOf(NSToInts(b)); function operator<(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsProperSubsetOf(NSToInts(b));
function operator<(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b > a; function operator<(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b > a;
function operator<(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.IsProperSubsetOf(NSToInts64(b)); function operator<(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsProperSubsetOf(NSToInts64(b));
function operator<(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b > a; function operator<(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b > a;
function operator>(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.IsProperSupersetOf(NSToInts(b)); function operator>(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsProperSupersetOf(NSToInts(b));
function operator>(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b < a; function operator>(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b < a;
function operator>(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.IsProperSupersetOf(NSToInts64(b)); function operator>(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsProperSupersetOf(NSToInts64(b));
function operator>(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b < a; function operator>(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b < a;
function operator<=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.IsSubsetOf(NSToInts(b)); function operator<=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsSubsetOf(NSToInts(b));
function operator<=(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b >= a; function operator<=(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b >= a;
function operator<=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.IsSubsetOf(NSToInts64(b)); function operator<=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsSubsetOf(NSToInts64(b));
function operator<=(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b >= a; function operator<=(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b >= a;
function operator>=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.IsSupersetOf(NSToInts(b)); function operator>=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsSupersetOf(NSToInts(b));
function operator>=(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b <= a; function operator>=(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b <= a;
function operator>=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.IsSupersetOf(NSToInts64(b)); function operator>=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsSupersetOf(NSToInts64(b));
function operator>=(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b <= a; function operator>=(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b <= a;
procedure operator*=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a.hs.IntersectWith(NSToBytes(b)); procedure operator*=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a._hs.IntersectWith(NSToBytes(b));
procedure operator*=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.IntersectWith(NSToInts(b)); procedure operator*=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IntersectWith(NSToInts(b));
procedure operator*=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.IntersectWith(NSToInts64(b)); procedure operator*=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IntersectWith(NSToInts64(b));
//procedure operator*=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.IntersectWith(NSToInts(b)); //procedure operator*=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.IntersectWith(NSToInts(b));
//procedure operator*=(var a: NewSet<byte>; b: NewSet<int64>); extensionmethod := a._hs.IntersectWith(NSToBytes(b)); //procedure operator*=(var a: NewSet<byte>; b: NewSet<int64>); extensionmethod := a._hs.IntersectWith(NSToBytes(b));
//procedure operator*=(var a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.IntersectWith(NSToInts64(b)); //procedure operator*=(var a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.IntersectWith(NSToInts64(b));
procedure operator+=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a.hs.UnionWith(NSToBytes(b)); procedure operator+=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a._hs.UnionWith(NSToBytes(b));
procedure operator+=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.UnionWith(NSToInts(b)); procedure operator+=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.UnionWith(NSToInts(b));
procedure operator+=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.UnionWith(NSToInts64(b)); procedure operator+=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.UnionWith(NSToInts64(b));
//procedure operator+=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.UnionWith(NSToInts(b)); //procedure operator+=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.UnionWith(NSToInts(b));
procedure operator+=(var a: NewSet<byte>; b: NewSet<int64>); extensionmethod := a.hs.UnionWith(NSToBytes(b)); procedure operator+=(var a: NewSet<byte>; b: NewSet<int64>); extensionmethod := a._hs.UnionWith(NSToBytes(b));
procedure operator+=(var a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a.hs.UnionWith(NSToInts64(b)); procedure operator+=(var a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.UnionWith(NSToInts64(b));
procedure operator-=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a.hs.ExceptWith(NSToBytes(b)); procedure operator-=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a._hs.ExceptWith(NSToBytes(b));
procedure operator-=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.ExceptWith(NSToInts(b)); procedure operator-=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.ExceptWith(NSToInts(b));
procedure operator-=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.ExceptWith(NSToInts64(b)); procedure operator-=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.ExceptWith(NSToInts64(b));
//procedure operator-=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.ExceptWith(NSToInts(b)); //procedure operator-=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.ExceptWith(NSToInts(b));
@ -686,7 +686,7 @@ begin
end; end;
// и для массивов столько же // и для массивов столько же
function operator=(a: NewSet<integer>; b: array of byte); extensionmethod := a.hs.SetEquals(b.Select(x -> integer(x))); function operator=(a: NewSet<integer>; b: array of byte); extensionmethod := a._hs.SetEquals(b.Select(x -> integer(x)));
function operator=(a: array of byte; b: NewSet<integer>): boolean; extensionmethod := b = a; function operator=(a: array of byte; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: array of int64; b: NewSet<integer>); extensionmethod := a.ToHashSet.SetEquals(NSToInts64(b)); function operator=(a: array of int64; b: NewSet<integer>); extensionmethod := a.ToHashSet.SetEquals(NSToInts64(b));
function operator=(a: NewSet<integer>; b: array of int64): boolean; extensionmethod := b = a; function operator=(a: NewSet<integer>; b: array of int64): boolean; extensionmethod := b = a;

View file

@ -490,14 +490,14 @@ type
private private
public public
///-- ///--
hs := new HashSet<T>; _hs := new HashSet<T>;
///-- ///--
{function hs: HashSet<T>; function hs: HashSet<T>;
begin begin
if _hs = nil then if _hs = nil then
_hs := new HashSet<T>; _hs := new HashSet<T>;
Result := _hs; Result := _hs;
end;} end;
constructor (params a: array of T); constructor (params a: array of T);
begin begin
hs.UnionWith(a); hs.UnionWith(a);
@ -506,7 +506,7 @@ type
function System.Collections.IEnumerable.GetEnumerator: System.Collections.IEnumerator := GetEnumerator; function System.Collections.IEnumerable.GetEnumerator: System.Collections.IEnumerator := GetEnumerator;
static function operator implicit(a: array of T): NewSet<T>; static function operator implicit(a: array of T): NewSet<T>;
begin begin
Result.hs := new HashSet<T>(a); Result._hs := new HashSet<T>(a);
end; end;
function ToString: string; override; function ToString: string; override;
function Count: integer := hs.Count; function Count: integer := hs.Count;
@ -550,9 +550,9 @@ type
end; end;
static function operator implicit(ns: NewSetEmpty): NewSet<T>; begin end; static function operator implicit(ns: NewSetEmpty): NewSet<T>; begin end;
static function operator:=(var Self: NewSet<T>; st: NewSet<T>): NewSet<T>; static function operator:=(var s: NewSet<T>; st: NewSet<T>): NewSet<T>;
begin begin
Self.hs := new HashSet<T>(st.hs); s._hs := new HashSet<T>(st.hs);
end; end;
end; end;
@ -577,11 +577,11 @@ type
static function operator*(first, second: NewSetEmpty): NewSetEmpty := new NewSetEmpty; static function operator*(first, second: NewSetEmpty): NewSetEmpty := new NewSetEmpty;
static function operator+<T>(first: NewSetEmpty; second: array of T): NewSet<T>; static function operator+<T>(first: NewSetEmpty; second: array of T): NewSet<T>;
begin begin
Result.hs.UnionWith(second); Result._hs.UnionWith(second);
end; end;
static function operator+<T>(first: array of T; second: NewSetEmpty): NewSet<T>; static function operator+<T>(first: array of T; second: NewSetEmpty): NewSet<T>;
begin begin
Result.hs.UnionWith(first); Result._hs.UnionWith(first);
end; end;
static function operator+<T>(first: NewSet<T>; second: NewSetEmpty): NewSet<T> := first; static function operator+<T>(first: NewSet<T>; second: NewSetEmpty): NewSet<T> := first;
static function operator+<T>(first: NewSetEmpty; second: NewSet<T>): NewSet<T> := second; static function operator+<T>(first: NewSetEmpty; second: NewSet<T>): NewSet<T> := second;
@ -595,7 +595,7 @@ type
static function operator-<T>(first: NewSetEmpty; second: array of T): NewSet<T>; begin end; static function operator-<T>(first: NewSetEmpty; second: array of T): NewSet<T>; begin end;
static function operator-<T>(first: array of T; second: NewSetEmpty): NewSet<T>; static function operator-<T>(first: array of T; second: NewSetEmpty): NewSet<T>;
begin begin
Result.hs.UnionWith(first); Result._hs.UnionWith(first);
end; end;
function ToString: string; override := '{}'; function ToString: string; override := '{}';
function ToSet<T>(): NewSet<T>; begin end; function ToSet<T>(): NewSet<T>; begin end;
@ -15413,14 +15413,14 @@ function EmptySet := _emptyset;
[SetCreatorFunction] [SetCreatorFunction]
function __NewSetCreatorInternal<T>(params a: array of T): NewSet<T>; function __NewSetCreatorInternal<T>(params a: array of T): NewSet<T>;
begin begin
Result.hs := new HashSet<T>; Result._hs := new HashSet<T>;
Result.hs.UnionWith(a); Result._hs.UnionWith(a);
end; end;
[SetCreatorFunction] [SetCreatorFunction]
function __NSetInteger(a: array of integer; dd: array of integer): NewSet<integer>; function __NSetInteger(a: array of integer; dd: array of integer): NewSet<integer>;
begin begin
Result.hs.UnionWith(a); Result._hs.UnionWith(a);
var n := dd.Length; var n := dd.Length;
for var i:=0 to n-1 step 2 do for var i:=0 to n-1 step 2 do
begin begin
@ -15432,7 +15432,7 @@ end;
[SetCreatorFunction] [SetCreatorFunction]
function __NSetChar(a: array of char; dd: array of char): NewSet<char>; function __NSetChar(a: array of char; dd: array of char): NewSet<char>;
begin begin
Result.hs.UnionWith(a); Result._hs.UnionWith(a);
var n := dd.Length; var n := dd.Length;
for var i:=0 to n-1 step 2 do for var i:=0 to n-1 step 2 do
begin begin
@ -15444,7 +15444,7 @@ end;
[SetCreatorFunction] [SetCreatorFunction]
function __NSetBoolean(a: array of boolean; dd: array of boolean): NewSet<boolean>; function __NSetBoolean(a: array of boolean; dd: array of boolean): NewSet<boolean>;
begin begin
Result.hs.UnionWith(a); Result._hs.UnionWith(a);
var n := dd.Length; var n := dd.Length;
for var i:=0 to n-1 step 2 do for var i:=0 to n-1 step 2 do
begin begin
@ -15456,7 +15456,7 @@ end;
[SetCreatorFunction] [SetCreatorFunction]
function __NSetEnum<T>(a: array of T; dd: array of T): NewSet<T>; function __NSetEnum<T>(a: array of T; dd: array of T): NewSet<T>;
begin begin
Result.hs.UnionWith(a); Result._hs.UnionWith(a);
var vals := System.Enum.GetValues(typeof(T)).Cast&<T>.ToArray; var vals := System.Enum.GetValues(typeof(T)).Cast&<T>.ToArray;
var n := dd.Length; var n := dd.Length;
for var i:=0 to n-1 step 2 do for var i:=0 to n-1 step 2 do
@ -15478,49 +15478,49 @@ end;
function operator implicit(n: array of integer): set of byte; extensionmethod; function operator implicit(n: array of integer): set of byte; extensionmethod;
begin begin
foreach var x in n do foreach var x in n do
Result.hs.Add(x); Result._hs.Add(x);
end; end;
function operator implicit(n: array of integer): set of shortint; extensionmethod; function operator implicit(n: array of integer): set of shortint; extensionmethod;
begin begin
foreach var x in n do foreach var x in n do
Result.hs.Add(x); Result._hs.Add(x);
end; end;
function operator implicit(n: array of integer): set of smallint; extensionmethod; function operator implicit(n: array of integer): set of smallint; extensionmethod;
begin begin
foreach var x in n do foreach var x in n do
Result.hs.Add(x); Result._hs.Add(x);
end; end;
function operator implicit(n: array of integer): set of word; extensionmethod; function operator implicit(n: array of integer): set of word; extensionmethod;
begin begin
foreach var x in n do foreach var x in n do
Result.hs.Add(x); Result._hs.Add(x);
end; end;
function operator implicit(n: array of integer): set of longword; extensionmethod; function operator implicit(n: array of integer): set of longword; extensionmethod;
begin begin
foreach var x in n do foreach var x in n do
Result.hs.Add(x); Result._hs.Add(x);
end; end;
function operator implicit(a: array of integer): set of int64; extensionmethod; function operator implicit(a: array of integer): set of int64; extensionmethod;
begin begin
foreach var x in a do foreach var x in a do
Result.hs.Add(x); Result._hs.Add(x);
end; end;
function operator implicit(a: array of integer): set of uint64; extensionmethod; function operator implicit(a: array of integer): set of uint64; extensionmethod;
begin begin
foreach var x in a do foreach var x in a do
Result.hs.Add(x); Result._hs.Add(x);
end; end;
function operator implicit(a: array of integer): set of BigInteger; extensionmethod; function operator implicit(a: array of integer): set of BigInteger; extensionmethod;
begin begin
foreach var x in a do foreach var x in a do
Result.hs.Add(x); Result._hs.Add(x);
end; end;
//function operator implicit<T>(ns: NewSetEmpty): NewSet<T>; extensionmethod; begin end; //function operator implicit<T>(ns: NewSetEmpty): NewSet<T>; extensionmethod; begin end;

View file

@ -11,6 +11,8 @@ begin
assert(set1.set1 = []); assert(set1.set1 = []);
assert(set1.set2 = []); assert(set1.set2 = []);
set2 := set1; set2 := set1;
Include(set1.set1,'b');
Include(set1.set2,'b');
Include(set2.set1,'b'); Include(set2.set1,'b');
Include(set2.set2,'b'); Include(set2.set2,'b');
assert(set1.set1 = ['b']); // увы - при присваивании не вызывается operator := для компонент assert(set1.set1 = ['b']); // увы - при присваивании не вызывается operator := для компонент

View file

@ -15617,14 +15617,27 @@ namespace PascalABCCompiler.TreeConverter
else if (expr is common_static_method_call) else if (expr is common_static_method_call)
{ {
var csmc = expr as common_static_method_call; var csmc = expr as common_static_method_call;
var properties = new List<common_property_node>(); if (csmc.function_node.cont_type != null)
foreach (common_property_node cpn in csmc.function_node.cont_type.properties) {
if (cpn.get_function == csmc.function_node && cpn.set_function == null) foreach (common_property_node cpn in csmc.function_node.cont_type.properties)
if (cpn.get_function == csmc.function_node && cpn.set_function == null)
{
constant = new common_static_method_call_as_constant(csmc, null);
break;
}
}
else
{
var values = (csmc.parameters[0] as array_initializer).element_values;
// Надо компоненты проверять на константность
foreach (expression_node en in values)
{ {
constant = new common_static_method_call_as_constant(csmc, null); if (!(en is constant_node))
break; AddError(loc, "CONSTANT_EXPRESSION_EXPECTED");
} }
constant = new common_static_method_call_as_constant(csmc, loc);
return constant;
}
} }
else else
{ {