This commit is contained in:
Mikhalkovich Stanislav 2020-12-09 19:09:36 +03:00
parent 969b81f48a
commit 608afb9339
7 changed files with 66 additions and 4 deletions

View file

@ -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;

View file

@ -1,4 +1,4 @@
%COREVERSION%=1
%REVISION%=2764
%REVISION%=2766
%MINOR%=7
%MAJOR%=3

View file

@ -1 +1 @@
3.7.1.2764
3.7.1.2766

View file

@ -1 +1 @@
!define VERSION '3.7.1.2764'
!define VERSION '3.7.1.2766'

View file

@ -39,6 +39,15 @@ namespace SyntaxVisitors.SugarVisitors
DefaultVisit(ne);
}
public override void visit(labeled_statement ls)
{
var sl = new List<statement>();
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))

View file

@ -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
// -----------------------------------------------------

View file

@ -0,0 +1,8 @@
label 1;
begin
var c := 1;
1:
var (a,b) := (1,1);
b := 1;
Assert(b=1);
end.