diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 105c82ae3..933afada3 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 = "7"; public const string Build = "1"; - public const string Revision = "2764"; + public const string Revision = "2766"; 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 fbc578e14..cc0355db1 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=1 -%REVISION%=2764 +%REVISION%=2766 %MINOR%=7 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 78e99bcd5..df53a7c94 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.7.1.2764 +3.7.1.2766 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index b51f7f199..7e80c67dc 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.7.1.2764' +!define VERSION '3.7.1.2766' diff --git a/SyntaxVisitors/SugarVisitors/TupleVisitor.cs b/SyntaxVisitors/SugarVisitors/TupleVisitor.cs index 31b5d5c66..ec68ff2c6 100644 --- a/SyntaxVisitors/SugarVisitors/TupleVisitor.cs +++ b/SyntaxVisitors/SugarVisitors/TupleVisitor.cs @@ -39,6 +39,15 @@ namespace SyntaxVisitors.SugarVisitors DefaultVisit(ne); } + public override void visit(labeled_statement ls) + { + var sl = new List(); + sl.Add(new labeled_statement(ls.label_name, new empty_statement(), ls.source_context)); + sl.Add(ls.to_statement); + ReplaceStatementUsingParent(ls, sl); + ProcessNode(ls.to_statement); + } + public override void visit(assign_var_tuple assvartup) { if (assvartup.expr is tuple_node tn && tn.el.expressions.All(ex => ex is const_node) && !tn.el.expressions.Any(ex => ex is nil_const)) diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index ec6b68545..bc2865507 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -253,6 +253,9 @@ type /// Предоставляет методы для точного измерения затраченного времени Stopwatch = System.Diagnostics.Stopwatch; + /// Указывает на возможность сериализации класса + Serializable = System.SerializableAttribute; + /// Представляет тип короткой строки фиксированной длины 255 символов ShortString = string[255]; @@ -586,6 +589,10 @@ type function ReadReal: real; /// Считывает строку из бестипового файла function ReadString: string; + /// Сериализует объект в файл (объект должен иметь атрибут [Serializable]) + procedure Serialize(obj: object); + /// Десериализует объект из файла + function Deserialize: object; end; type @@ -1183,6 +1190,12 @@ procedure Println(params args: array of object); /// Выводит значения a,b,... в текстовый файл f, после каждого значения выводит пробел и переходит на новую строку procedure Println(f: Text; params args: array of object); +/// Сериализует объект в файл (объект должен иметь атрибут [Serializable]) +procedure Serialize(filename: string; obj: object); +/// Десериализует объект из файла +function Deserialize(filename: string): object; + + // ----------------------------------------------------- //>> Общие подпрограммы для работы с файлами # Common subroutines for files // ----------------------------------------------------- @@ -2818,6 +2831,9 @@ function WINAPI_AllocConsole: longword; external 'kernel32.dll' name 'AllocConso var console_alloc: boolean := false; + +type + BinaryFormatter = System.Runtime.Serialization.Formatters.Binary.BinaryFormatter; // ----------------------------------------------------- // Internal functions @@ -6677,6 +6693,18 @@ begin Result := Self.br.ReadString; end; +procedure BinaryFile.Serialize(obj: object); +begin + var formatter := new BinaryFormatter; + formatter.Serialize(fs,obj); +end; + +function BinaryFile.Deserialize: object; +begin + var formatter := new BinaryFormatter; + Result := formatter.Deserialize(fs); +end; + // ----------------------------------------------------- // Eoln - Eof // ----------------------------------------------------- @@ -6997,6 +7025,23 @@ begin Print(f, args); Writeln(f); end; + +procedure Serialize(filename: string; obj: object); +begin + var fs := new System.IO.FileStream(filename,System.IO.FileMode.Create); + var formatter := new BinaryFormatter; + formatter.Serialize(fs,obj); + fs.Close; +end; + +function Deserialize(filename: string): object; +begin + var fs := new System.IO.FileStream(filename,System.IO.FileMode.Open); + var formatter := new BinaryFormatter; + Result := formatter.Deserialize(fs); + fs.Close; +end; + // ----------------------------------------------------- // Text files // ----------------------------------------------------- diff --git a/TestSuite/label_ass_var_tuple.pas b/TestSuite/label_ass_var_tuple.pas new file mode 100644 index 000000000..cfa9cbf79 --- /dev/null +++ b/TestSuite/label_ass_var_tuple.pas @@ -0,0 +1,8 @@ +label 1; +begin + var c := 1; + 1: + var (a,b) := (1,1); + b := 1; + Assert(b=1); +end. \ No newline at end of file