This commit is contained in:
Mikhalkovich Stanislav 2019-03-20 20:40:32 +03:00
parent 7476f2ed2e
commit bab26658da
6 changed files with 57 additions and 9 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "4";
public const string Build = "2";
public const string Revision = "2002";
public const string Revision = "2003";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=4
%REVISION%=2002
%COREVERSION%=2
%REVISION%=2003
%MINOR%=4
%MAJOR%=3

View file

@ -1 +1 @@
!define VERSION '3.4.2.2002'
!define VERSION '3.4.2.2003'

View file

@ -0,0 +1,5 @@
begin
var s: set of string := ['b','d '];
foreach var o in s do
Assert(o.GetType = typeof(string));
end.

View file

@ -4842,8 +4842,6 @@ namespace PascalABCCompiler.TreeConverter
types.AddElement(en.type);
}
}
expressions_list consts_copy = new expressions_list();
consts_copy.AddRange(consts);
type_node ctn = null;
if (consts.Count > 0)
{
@ -4855,7 +4853,22 @@ namespace PascalABCCompiler.TreeConverter
}
else ctn = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node;
/*if (el_type == SystemLibrary.SystemLibrary.string_type)
{
for (int i = 0; i < consts.Count; i++)
if (consts[i].type == SystemLibrary.SystemLibrary.char_type)
{
consts[i] = convertion_data_and_alghoritms.convert_type(consts[i], el_type);
}
} */ // Не работает ! SSM 19.03.19
expressions_list consts_copy = new expressions_list();
consts_copy.AddRange(consts);
function_node fn = convertion_data_and_alghoritms.select_function(consts, SystemLibrary.SystemLibInitializer.CreateSetProcedure.SymbolInfo, (SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info is common_namespace_function_node)?(SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info as common_namespace_function_node).loc:null);
if (fn is common_namespace_function_node)
{
common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node, get_location(_pascal_set_constant));

View file

@ -3031,7 +3031,7 @@ begin
Result.high := high;
end;
[System.Diagnostics.DebuggerStepThrough]
//[System.Diagnostics.DebuggerStepThrough]
function CreateObjDiapason(low, high: object): Diapason;
begin
Result.clow := low;
@ -3041,9 +3041,39 @@ end;
[System.Diagnostics.DebuggerStepThrough]
function CreateSet(params elems: array of object): TypedSet;
begin
var chars := false;
var strings := false;
var others := false;
foreach var x in elems do
begin
if (x is char) or (x is Diapason) and (Diapason(x).clow is char) then
chars := true
else if x is string then
strings := true
else
begin
others := true;
break
end;
end;
Result := new TypedSet();
for var i := 0 to elems.Length - 1 do
Result.IncludeElement(elems[i]);
if chars and strings and not others then
foreach var x in elems do
if x is char then
Result.IncludeElement(x.ToString)
else if (x is Diapason) and (Diapason(x).clow is char) then
begin
var c1 := char(Diapason(x).clow);
var c2 := char(Diapason(x).chigh);
for var cc := c1 to c2 do
Result.IncludeElement(cc.ToString)
end
else Result.IncludeElement(x)
else
foreach var x in elems do
Result.IncludeElement(x);
end;
[System.Diagnostics.DebuggerStepThrough]