diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 3226e6d89..6c10f07cb 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 = "1"; public const string Build = "0"; - public const string Revision = "1297"; + public const string Revision = "1305"; 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 00cd862d3..780be2fde 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=0 -%REVISION%=1297 +%REVISION%=1305 %MINOR%=1 %MAJOR%=3 diff --git a/PascalABCNET.axml b/PascalABCNET.axml index 8c6fef4d7..b98d933dd 100644 --- a/PascalABCNET.axml +++ b/PascalABCNET.axml @@ -1299,7 +1299,7 @@ - + \SyntaxTreeConverters\AddStandardSyntaxConverters.cs static class AddStandardSyntaxConverters @@ -1309,6 +1309,21 @@ + + \StandardSyntaxTreeConverter\StandardSyntaxConverters.cs + class StandardSyntaxTreeConverter: ISyntaxTreeConverter + + class StandardSyntaxTreeConverter : ISyntaxTreeConverter + namespace PascalABCCompiler . SyntaxTreeConverters + + + + + public string Name + = + public syntax_tree_node Convert ( syntax_tree_node root ) + + diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 81a7660a5..3d69a3a3a 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.1.0.1297' +!define VERSION '3.1.0.1305' diff --git a/TestSuite/CompilationSamples/FormsABC.pas b/TestSuite/CompilationSamples/FormsABC.pas index 3b43d302d..986fef6ab 100644 --- a/TestSuite/CompilationSamples/FormsABC.pas +++ b/TestSuite/CompilationSamples/FormsABC.pas @@ -73,18 +73,15 @@ type protected b := new System.Windows.Forms.Button; procedure BClick(sender: Object; e: EventArgs); - function GetW(): integer; - begin - Result := b.Width - end; - procedure SetW(w: integer); - begin - b.Width := w; - end; + function GetW := b.Width; + procedure SetW(w: integer) := b.Width := w; + function GetText := b.Text; + procedure SetText(t: string) := b.Text := t; public event Click: procedure; constructor Create(text: string); property Width: integer read GetW write SetW; + property Text: string read GetText write SetText; end; /// Текстовая метка diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 207d6a9d3..7ddc068f1 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -1046,6 +1046,10 @@ function Sign(x: real): integer; /// Возвращает модуль числа x function Abs(x: integer): integer; ///-- +function Abs(x: shortint): shortint; +///-- +function Abs(x: smallint): smallint; +///-- function Abs(x: BigInteger): BigInteger; ///-- function Abs(x: longword): longword; @@ -1090,6 +1094,10 @@ function Sqrt(x: real): real; /// Возвращает квадрат числа x function Sqr(x: integer): int64; ///-- +function Sqr(x: shortint): integer; +///-- +function Sqr(x: smallint): integer; +///-- function Sqr(x: BigInteger): BigInteger; ///-- function Sqr(x: longword): uint64; @@ -3995,7 +4003,10 @@ end;} function ArrFill(count: integer; x: T): array of T; begin - Result := System.Linq.Enumerable.Repeat(x,count).ToArray(); + Result := new T[count]; + for var i:=0 to Result.Length-1 do + Result[i] := x; + //Result := System.Linq.Enumerable.Repeat(x,count).ToArray(); end; function ArrGen(count: integer; f: integer -> T; from: integer): array of T; @@ -6623,6 +6634,16 @@ begin Result := Math.Sign(x); end; +function Abs(x: shortint): shortint; +begin + Result := Math.Abs(x); +end; + +function Abs(x: smallint): smallint; +begin + Result := Math.Abs(x); +end; + function Abs(x: integer): integer; begin Result := Math.Abs(x); @@ -6733,6 +6754,16 @@ begin Result := x * x; end; +function Sqr(x: shortint): integer; +begin + Result := x * x; +end; + +function Sqr(x: smallint): integer; +begin + Result := x * x; +end; + function Sqr(x: BigInteger): BigInteger; begin Result := x * x; @@ -8693,6 +8724,102 @@ begin end; end; +type + AdjGroupClass = class + private + cur: T; + enm: IEnumerator; + fin: boolean; + public + constructor Create(a: sequence of T); + begin + enm := a.GetEnumerator(); + fin := enm.MoveNext; + if fin then + cur := enm.Current; + end; + + function TakeGroup: sequence of T; + begin + yield cur; + fin := enm.movenext; + while fin do + begin + if enm.current = cur then + yield enm.current + else + begin + cur := enm.Current; + break; + end; + fin := enm.movenext; + end; + end; + end; + +/// Группирует одинаковые подряд идущие элементы, получая последовательность последовательностей +function AdjacentGroup(Self: sequence of T): sequence of sequence of T; extensionmethod; +begin + var c := new AdjGroupClass(Self); + while c.fin do + yield c.TakeGroup(); +end; + +/// Возвращает минимальный элемент +function Min(Self: array of T): T; extensionmethod; where T: System.IComparable; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i].CompareTo(Result)<0 then + Result := Self[i]; +end; + +/// Возвращает максинимальный элемент +function Max(Self: array of T): T; extensionmethod; where T: System.IComparable; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i].CompareTo(Result)>0 then + Result := Self[i]; +end; + +/// Возвращает минимальный элемент +function Min(Self: array of integer): integer; extensionmethod; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i] < Result then + Result := Self[i]; +end; + +/// Возвращает минимальный элемент +function Min(Self: array of real): real; extensionmethod; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i] < Result then + Result := Self[i]; +end; + +/// Возвращает максимальный элемент +function Max(Self: array of integer): integer; extensionmethod; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i] > Result then + Result := Self[i]; +end; + +/// Возвращает максимальный элемент +function Max(Self: array of real): real; extensionmethod; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i] > Result then + Result := Self[i]; +end; + + /// Возвращает индекс первого минимального элемента начиная с позиции start function IndexMin(Self: array of T; start: integer := 0): integer; extensionmethod; where T: System.IComparable; begin diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index fb7643ce9..9e506aba4 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -9242,11 +9242,24 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.dot_node _dot_node) { - var mot = motivation_keeper.motivation; + var mot = motivation_keeper.motivation; + SyntaxTree.ident id_left = _dot_node.left as SyntaxTree.ident; SyntaxTree.ident id_right = _dot_node.right as SyntaxTree.ident; if (_dot_node.right is ident_with_templateparams) id_right = (_dot_node.right as ident_with_templateparams).name as ident; + + // SSM 18.08.16 - пробуем обработать захват enn.ii в yieldах где enn - поле класса и нуждается в переименовании + // Так же ниже делает lroman + if (_dot_node.left is yield_unknown_ident) + { + var yui = (yield_unknown_ident)_dot_node.left; + var av = ProcessUnknownIdent(yui); + var dn = new dot_node(av, _dot_node.right,yui.source_context); + visit(dn); + return; + } + //lroman if (_dot_node.left is closure_substituting_node) { @@ -19221,7 +19234,8 @@ namespace PascalABCCompiler.TreeConverter bool isStaticIdent; if (CheckUnknownIdentNeedsClassCapture(unk, out isStaticIdent)) { - return CaptureUnknownIdent(unk, isStaticIdent); + var uid = CaptureUnknownIdent(unk, isStaticIdent); + return uid; } else { diff --git a/Yield/YieldConversionSyntax/YieldDesugarSyntaxTreeConverter.cs b/Yield/YieldConversionSyntax/YieldDesugarSyntaxTreeConverter.cs index d6df85f8a..e365837d2 100644 --- a/Yield/YieldConversionSyntax/YieldDesugarSyntaxTreeConverter.cs +++ b/Yield/YieldConversionSyntax/YieldDesugarSyntaxTreeConverter.cs @@ -30,7 +30,7 @@ namespace YieldDesugarSyntaxTreeConverter #if DEBUG try { - //root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz1.txt")); + //root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz1.txt")); } catch { diff --git a/bin/Lib/FormsABC.pas b/bin/Lib/FormsABC.pas index 3b43d302d..986fef6ab 100644 --- a/bin/Lib/FormsABC.pas +++ b/bin/Lib/FormsABC.pas @@ -73,18 +73,15 @@ type protected b := new System.Windows.Forms.Button; procedure BClick(sender: Object; e: EventArgs); - function GetW(): integer; - begin - Result := b.Width - end; - procedure SetW(w: integer); - begin - b.Width := w; - end; + function GetW := b.Width; + procedure SetW(w: integer) := b.Width := w; + function GetText := b.Text; + procedure SetText(t: string) := b.Text := t; public event Click: procedure; constructor Create(text: string); property Width: integer read GetW write SetW; + property Text: string read GetText write SetText; end; /// Текстовая метка diff --git a/bin/Lib/PABCRtl.dll b/bin/Lib/PABCRtl.dll index cbac79a8c..47bda1e82 100644 Binary files a/bin/Lib/PABCRtl.dll and b/bin/Lib/PABCRtl.dll differ diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 207d6a9d3..7ddc068f1 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -1046,6 +1046,10 @@ function Sign(x: real): integer; /// Возвращает модуль числа x function Abs(x: integer): integer; ///-- +function Abs(x: shortint): shortint; +///-- +function Abs(x: smallint): smallint; +///-- function Abs(x: BigInteger): BigInteger; ///-- function Abs(x: longword): longword; @@ -1090,6 +1094,10 @@ function Sqrt(x: real): real; /// Возвращает квадрат числа x function Sqr(x: integer): int64; ///-- +function Sqr(x: shortint): integer; +///-- +function Sqr(x: smallint): integer; +///-- function Sqr(x: BigInteger): BigInteger; ///-- function Sqr(x: longword): uint64; @@ -3995,7 +4003,10 @@ end;} function ArrFill(count: integer; x: T): array of T; begin - Result := System.Linq.Enumerable.Repeat(x,count).ToArray(); + Result := new T[count]; + for var i:=0 to Result.Length-1 do + Result[i] := x; + //Result := System.Linq.Enumerable.Repeat(x,count).ToArray(); end; function ArrGen(count: integer; f: integer -> T; from: integer): array of T; @@ -6623,6 +6634,16 @@ begin Result := Math.Sign(x); end; +function Abs(x: shortint): shortint; +begin + Result := Math.Abs(x); +end; + +function Abs(x: smallint): smallint; +begin + Result := Math.Abs(x); +end; + function Abs(x: integer): integer; begin Result := Math.Abs(x); @@ -6733,6 +6754,16 @@ begin Result := x * x; end; +function Sqr(x: shortint): integer; +begin + Result := x * x; +end; + +function Sqr(x: smallint): integer; +begin + Result := x * x; +end; + function Sqr(x: BigInteger): BigInteger; begin Result := x * x; @@ -8693,6 +8724,102 @@ begin end; end; +type + AdjGroupClass = class + private + cur: T; + enm: IEnumerator; + fin: boolean; + public + constructor Create(a: sequence of T); + begin + enm := a.GetEnumerator(); + fin := enm.MoveNext; + if fin then + cur := enm.Current; + end; + + function TakeGroup: sequence of T; + begin + yield cur; + fin := enm.movenext; + while fin do + begin + if enm.current = cur then + yield enm.current + else + begin + cur := enm.Current; + break; + end; + fin := enm.movenext; + end; + end; + end; + +/// Группирует одинаковые подряд идущие элементы, получая последовательность последовательностей +function AdjacentGroup(Self: sequence of T): sequence of sequence of T; extensionmethod; +begin + var c := new AdjGroupClass(Self); + while c.fin do + yield c.TakeGroup(); +end; + +/// Возвращает минимальный элемент +function Min(Self: array of T): T; extensionmethod; where T: System.IComparable; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i].CompareTo(Result)<0 then + Result := Self[i]; +end; + +/// Возвращает максинимальный элемент +function Max(Self: array of T): T; extensionmethod; where T: System.IComparable; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i].CompareTo(Result)>0 then + Result := Self[i]; +end; + +/// Возвращает минимальный элемент +function Min(Self: array of integer): integer; extensionmethod; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i] < Result then + Result := Self[i]; +end; + +/// Возвращает минимальный элемент +function Min(Self: array of real): real; extensionmethod; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i] < Result then + Result := Self[i]; +end; + +/// Возвращает максимальный элемент +function Max(Self: array of integer): integer; extensionmethod; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i] > Result then + Result := Self[i]; +end; + +/// Возвращает максимальный элемент +function Max(Self: array of real): real; extensionmethod; +begin + Result := Self[0]; + for var i:=1 to Self.Length-1 do + if Self[i] > Result then + Result := Self[i]; +end; + + /// Возвращает индекс первого минимального элемента начиная с позиции start function IndexMin(Self: array of T; start: integer := 0): integer; extensionmethod; where T: System.IComparable; begin diff --git a/bin/PascalABCNET.chm b/bin/PascalABCNET.chm index d190fed2d..4178ca996 100644 Binary files a/bin/PascalABCNET.chm and b/bin/PascalABCNET.chm differ