fix #2764
This commit is contained in:
parent
ff230aa1f2
commit
88c9ac464a
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "8";
|
||||
public const string Build = "3";
|
||||
public const string Revision = "3214";
|
||||
public const string Revision = "3218";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=3
|
||||
%REVISION%=3214
|
||||
%REVISION%=3218
|
||||
%MINOR%=8
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
3.8.3.3214
|
||||
3.8.3.3218
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.8.3.3214'
|
||||
!define VERSION '3.8.3.3218'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
begin
|
||||
var arr:=|12,23,34,45,56,67,78,89|;
|
||||
arr.Numerate.Nwise(3).where(\(\(a,b),\(c,d),\(e,f)) → a<b).print
|
||||
end.
|
||||
|
|
@ -10409,7 +10409,7 @@ begin
|
|||
end;
|
||||
|
||||
/// Превращает последовательность в последовательность n-ок соседних элементов
|
||||
function Nwise<T>(Self: sequence of T; n: integer):sequence of array of T; extensionmethod;
|
||||
function Nwise<T>(Self: sequence of T; n: integer): sequence of array of T; extensionmethod;
|
||||
begin
|
||||
var chunk := new Queue<T>(n);
|
||||
foreach var x in Self do
|
||||
|
|
|
|||
|
|
@ -91,15 +91,9 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (t == null)
|
||||
AddError(inwhatloc, "TUPLE_OR_SEQUENCE_EXPECTED_FOREACH");
|
||||
|
||||
var IsTuple = false;
|
||||
var IsSequence = false;
|
||||
if (t.FullName.StartsWith("System.Tuple") || t.FullName.StartsWith("System.ValueTuple"))
|
||||
IsTuple = true;
|
||||
if (!IsTuple)
|
||||
{
|
||||
if (t.Name.Equals("IEnumerable`1") || t.GetInterface("IEnumerable`1") != null)
|
||||
IsSequence = true;
|
||||
}
|
||||
var IsTuple = IsTupleType(t);
|
||||
var IsSequence = !IsTuple && IsSequenceType(t);
|
||||
|
||||
if (!IsTuple && !IsSequence)
|
||||
{
|
||||
AddError(inwhatloc, "TUPLE_OR_SEQUENCE_EXPECTED_FOREACH");
|
||||
|
|
|
|||
|
|
@ -20,15 +20,9 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (t == null)
|
||||
AddError(expr.location, "TUPLE_OR_SEQUENCE_EXPECTED");
|
||||
|
||||
var IsTuple = false;
|
||||
var IsSequence = false;
|
||||
if (t.FullName.StartsWith("System.Tuple") || t.FullName.StartsWith("System.ValueTuple"))
|
||||
IsTuple = true;
|
||||
if (!IsTuple)
|
||||
{
|
||||
if (t.Name.Equals("IEnumerable`1") || t.GetInterface("IEnumerable`1") != null)
|
||||
IsSequence = true;
|
||||
}
|
||||
var IsTuple = IsTupleType(t);
|
||||
var IsSequence = !IsTuple && IsSequenceType(t);
|
||||
|
||||
if (!IsTuple && !IsSequence)
|
||||
{
|
||||
AddError(expr.location, "TUPLE_OR_SEQUENCE_EXPECTED");
|
||||
|
|
@ -52,15 +46,9 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (t == null)
|
||||
AddError(expr.location, "TUPLE_OR_SEQUENCE_EXPECTED");
|
||||
|
||||
var IsTuple = false;
|
||||
var IsSequence = false;
|
||||
if (t.FullName.StartsWith("System.Tuple") || t.FullName.StartsWith("System.ValueTuple"))
|
||||
IsTuple = true;
|
||||
if (!IsTuple)
|
||||
{
|
||||
if (t.Name.Equals("IEnumerable`1") || t.GetInterface("IEnumerable`1") != null)
|
||||
IsSequence = true;
|
||||
}
|
||||
var IsTuple = IsTupleType(t);
|
||||
var IsSequence = !IsTuple && IsSequenceType(t);
|
||||
|
||||
if (!IsTuple && !IsSequence)
|
||||
{
|
||||
AddError(expr.location, "TUPLE_OR_SEQUENCE_EXPECTED");
|
||||
|
|
|
|||
|
|
@ -15939,7 +15939,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (ent != null)
|
||||
{
|
||||
var t = ent.compiled_type;
|
||||
if (t != null && !t.IsArray && t.FullName.StartsWith("System.Tuple"))
|
||||
if (t != null && IsTupleType(t))
|
||||
{
|
||||
expression eee = parameters.expressions[0];
|
||||
|
||||
|
|
@ -21421,6 +21421,16 @@ namespace PascalABCCompiler.TreeConverter
|
|||
ProcessNode(av.new_addr_value); // обойти десахарное
|
||||
}
|
||||
|
||||
public bool IsTupleType(Type t)
|
||||
{
|
||||
return !t.IsArray && (t.FullName.StartsWith("System.Tuple") || t.FullName.StartsWith("System.ValueTuple"));
|
||||
}
|
||||
|
||||
public bool IsSequenceType(Type t)
|
||||
{
|
||||
return t.Name.Equals("IEnumerable`1") || t.GetInterface("IEnumerable`1") != null;
|
||||
}
|
||||
|
||||
private void CheckUnpacking(expression ex, out expression_node sem_ex, out bool IsTuple, out bool IsSequence, int countvars, syntax_tree_node stn)
|
||||
{
|
||||
sem_ex = convert_strong(ex);
|
||||
|
|
@ -21428,15 +21438,10 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var t = ConvertSemanticTypeNodeToNETType(sem_ex.type);
|
||||
if (t == null)
|
||||
AddError(sem_ex.location, "TUPLE_OR_SEQUENCE_EXPECTED");
|
||||
IsTuple = false;
|
||||
IsSequence = false;
|
||||
if (t.FullName.StartsWith("System.Tuple"))
|
||||
IsTuple = true;
|
||||
if (!IsTuple)
|
||||
{
|
||||
if (t.Name.Equals("IEnumerable`1") || t.GetInterface("IEnumerable`1") != null)
|
||||
IsSequence = true;
|
||||
}
|
||||
|
||||
IsTuple = IsTupleType(t);
|
||||
IsSequence = !IsTuple && IsSequenceType(t);
|
||||
|
||||
if (!IsTuple && !IsSequence)
|
||||
{
|
||||
AddError(sem_ex.location, "TUPLE_OR_SEQUENCE_EXPECTED");
|
||||
|
|
@ -21508,11 +21513,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
var IsTuple = false;
|
||||
var IsSequence = false;
|
||||
if (t.FullName.StartsWith("System.Tuple"))
|
||||
if (IsTupleType(t))
|
||||
IsTuple = true;
|
||||
if (!IsTuple)
|
||||
{
|
||||
if (t.Name.Equals("IEnumerable`1") || t.GetInterface("IEnumerable`1") != null)
|
||||
if (IsSequenceType(t))
|
||||
IsSequence = true;
|
||||
}
|
||||
if (!IsTuple && !IsSequence)
|
||||
|
|
@ -21572,15 +21577,10 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var t = ConvertSemanticTypeNodeToNETType(sem_ex.type);
|
||||
if (t == null)
|
||||
AddError(sem_ex.location, "TUPLE_OR_SEQUENCE_EXPECTED");
|
||||
var IsTuple = false;
|
||||
var IsSequence = false;
|
||||
if ((t.FullName.StartsWith("System.Tuple") || t.FullName.StartsWith("System.ValueTuple")) && !(t.IsArray)) // ошибка - не проходит, когда есть System.Tuple[,][] т.е. массив туплов!!!
|
||||
IsTuple = true;
|
||||
if (!IsTuple)
|
||||
{
|
||||
if (t.Name.Equals("IEnumerable`1") || t.GetInterface("IEnumerable`1") != null)
|
||||
IsSequence = true;
|
||||
}
|
||||
|
||||
var IsTuple = IsTupleType(t);
|
||||
var IsSequence = !IsTuple && IsSequenceType(t);
|
||||
|
||||
if (!IsTuple && !IsSequence)
|
||||
{
|
||||
AddError(sem_ex.location, "TUPLE_OR_SEQUENCE_EXPECTED");
|
||||
|
|
|
|||
|
|
@ -82,10 +82,6 @@
|
|||
<Reference Include="Debugger.Core">
|
||||
<HintPath>..\Libraries\Debugger.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpDevelop.Dom, Version=4.2.1.8805, Culture=neutral, PublicKeyToken=f829da5c02be14ee, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>FormsDesignerBinding\Libs\ICSharpCode.SharpDevelop.Dom.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Build.Engine" />
|
||||
<Reference Include="Microsoft.Build.Framework" />
|
||||
<Reference Include="Microsoft.Build.Tasks" />
|
||||
|
|
|
|||
|
|
@ -10409,7 +10409,7 @@ begin
|
|||
end;
|
||||
|
||||
/// Превращает последовательность в последовательность n-ок соседних элементов
|
||||
function Nwise<T>(Self: sequence of T; n: integer):sequence of array of T; extensionmethod;
|
||||
function Nwise<T>(Self: sequence of T; n: integer): sequence of array of T; extensionmethod;
|
||||
begin
|
||||
var chunk := new Queue<T>(n);
|
||||
foreach var x in Self do
|
||||
|
|
|
|||
Loading…
Reference in a new issue