diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 09e88ffdd..382be7f27 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "2"; public const string Build = "0"; - public const string Revision = "1385"; + public const string Revision = "1386"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index f211f9c45..b61063e31 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=0 -%REVISION%=1385 %MINOR%=2 +%REVISION%=1386 +%COREVERSION%=0 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index a7793711c..9f11b628c 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.2.0.1385' +!define VERSION '3.2.0.1386' diff --git a/SyntaxTreeConverters/StandardSyntaxConverter.cs b/SyntaxTreeConverters/StandardSyntaxConverter.cs index 7949df55b..4e695ba9f 100644 --- a/SyntaxTreeConverters/StandardSyntaxConverter.cs +++ b/SyntaxTreeConverters/StandardSyntaxConverter.cs @@ -37,6 +37,18 @@ namespace PascalABCCompiler.SyntaxTreeConverters MarkMethodHasYieldAndCheckSomeErrorsVisitor.New.ProcessNode(root); ProcessYieldCapturedVarsVisitor.New.ProcessNode(root); +/*#if DEBUG + try + { + //root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz1.txt")); + } + catch + { + + } + +#endif*/ + return root; } } diff --git a/SyntaxVisitors/YieldVisitors/ReplaceVariableNameVisitor.cs b/SyntaxVisitors/YieldVisitors/ReplaceVariableNameVisitor.cs index 68df368a9..ea2bb35c6 100644 --- a/SyntaxVisitors/YieldVisitors/ReplaceVariableNameVisitor.cs +++ b/SyntaxVisitors/YieldVisitors/ReplaceVariableNameVisitor.cs @@ -31,7 +31,9 @@ namespace SyntaxVisitors if ( (object)upperNode != null && (object)(upperNode as dot_node) == null) { - Replace(id, _newName); + //Replace(id, _newName); + // заменяются только строки, а сами идентификаторы как объекты не меняются! + id.name = _newName.name; } } diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index e126c2345..1ebfecdb0 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -471,6 +471,8 @@ type ///- f.Write(a,b,...) /// Выводит значения a,b,... в двоичный файл procedure Write(params vals: array of object); + /// Устанавливает файловый указатель на начало файла + procedure Reset; end; // Class for typed files @@ -1523,7 +1525,11 @@ procedure Sort(l: List; less: (T,T)->boolean); /// Изменяет порядок элементов в динамическом массиве на противоположный procedure Reverse(a: array of T); /// Изменяет порядок элементов на противоположный в диапазоне динамического массива длины length начиная с индекса index -procedure Reverse(a: array of T; index,length: integer); +procedure Reverse(a: array of T; index,count: integer); +/// Изменяет порядок элементов в списке на противоположный +procedure Reverse(a: List); +/// Изменяет порядок элементов на противоположный в диапазоне списка длины length начиная с индекса index +procedure Reverse(a: List; index,count: integer); /// Перемешивает динамический массив случайным образом procedure Shuffle(a: array of T); /// Перемешивает список случайным образом @@ -3247,18 +3253,21 @@ end; //------------------------------------------------------------------------------ // Операции для List //------------------------------------------------------------------------------ +///-- function operator+=(a, b: List): List; extensionmethod; begin a.AddRange(b); Result := a; end; +///-- function operator+(a, b: List): List; extensionmethod; begin Result := new List(a); Result.AddRange(b); end; +///-- function operator+=(a: List; x: T): List; extensionmethod; begin a.Add(x); @@ -3271,6 +3280,40 @@ begin Result := Self.Contains(x); end; +///-- +function operator*(a: List; n: integer): List; extensionmethod; +begin + Result := new List(); + for var i := 1 to n do + Result.AddRange(a); +end; + +///-- +function operator*(n: integer; a: List): List; extensionmethod; +begin + Result := a*n; +end; + +//------------------------------------------------------------------------------ +// Операции для Stack +//------------------------------------------------------------------------------ +///-- +function operator+=(s: Stack; x: T): Stack; extensionmethod; +begin + s.Push(x); + Result := s; +end; + +//------------------------------------------------------------------------------ +// Операции для Queue +//------------------------------------------------------------------------------ +///-- +function operator+=(q: Queue; x: T): Queue; extensionmethod; +begin + q.Enqueue(x); + Result := q; +end; + //------------------------------------------------------------------------------ // Операции для HashSet //------------------------------------------------------------------------------ @@ -5197,6 +5240,11 @@ begin PABCSystem.Write(Self, vals); end; +procedure AbstractBinaryFile.Reset; +begin + PABCSystem.Reset(Self); +end; + // ----------------------------------------------------- // TypedFile & BinaryFile methods // ----------------------------------------------------- @@ -7072,11 +7120,22 @@ begin System.Array.Reverse(a); end; -procedure Reverse(a: array of T; index,length: integer); +procedure Reverse(a: array of T; index,count: integer); begin - System.Array.Reverse(a,index,length); + System.Array.Reverse(a,index,count); end; +procedure Reverse(a: List); +begin + a.Reverse +end; + +procedure Reverse(a: List; index,count: integer); +begin + a.Reverse(index,count) +end; + + procedure Shuffle(a: array of T); begin var n := a.Length; diff --git a/TestSuite/CompilationSamples/YieldForVar_i_i.pas b/TestSuite/CompilationSamples/YieldForVar_i_i.pas new file mode 100644 index 000000000..4930534a5 --- /dev/null +++ b/TestSuite/CompilationSamples/YieldForVar_i_i.pas @@ -0,0 +1,16 @@ +function MatrMainDiag(a: array[,]of integer):sequence of integer; +begin + for var i:=0 to 10 do + yield a[i,i] +end; + +function MatrMainDiag1(a: array[,]of integer):sequence of integer; +begin + for var i:=0 to 10 do + yield min(i,i) +end; + +begin + +end. + diff --git a/bin/Lib/PABCRtl.dll b/bin/Lib/PABCRtl.dll index 22d64df76..1c1b7ceeb 100644 Binary files a/bin/Lib/PABCRtl.dll and b/bin/Lib/PABCRtl.dll differ