diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 43a6ece10..ea831edae 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 = "8"; public const string Build = "0"; - public const string Revision = "2892"; + public const string Revision = "2896"; 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 b71da9438..2fdcef289 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=0 -%REVISION%=2892 +%REVISION%=2896 %MINOR%=8 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 54ce4a427..3b9ae757c 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.8.0.2892 +3.8.0.2896 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 664c0ebd0..93f9ee173 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.8.0.2892' +!define VERSION '3.8.0.2896' diff --git a/SyntaxTree/tree/TreeHelper.cs b/SyntaxTree/tree/TreeHelper.cs index 9e3cc6fcf..46f227b23 100644 --- a/SyntaxTree/tree/TreeHelper.cs +++ b/SyntaxTree/tree/TreeHelper.cs @@ -1362,26 +1362,26 @@ namespace PascalABCCompiler.SyntaxTree { } - public var_statement(ident id, type_definition type, expression iv) : this(new var_def_statement(new ident_list(id), type, iv)) + public var_statement(ident id, type_definition type, expression iv) : this(new var_def_statement(new ident_list(id, id.source_context), type, iv)) { } - public var_statement(ident id, type_definition type) : this(new var_def_statement(new ident_list(id), type)) + public var_statement(ident id, type_definition type) : this(new var_def_statement(new ident_list(id, id.source_context), type)) { } - public var_statement(ident id, type_definition type, SourceContext sc) : this(new var_def_statement(new ident_list(id), type, sc)) + public var_statement(ident id, type_definition type, SourceContext sc) : this(new var_def_statement(new ident_list(id, id.source_context), type, sc),sc) { } - public var_statement(ident id, string type) : this(new var_def_statement(new ident_list(id), new named_type_reference(type))) + public var_statement(ident id, string type) : this(new var_def_statement(new ident_list(id, id.source_context), new named_type_reference(type))) { } - public var_statement(ident id, expression iv) : this(new var_def_statement(new ident_list(id), null, iv)) + public var_statement(ident id, expression iv) : this(new var_def_statement(new ident_list(id,id.source_context), null, iv)) { } - public var_statement(ident id, expression iv, SourceContext sc) : this(new var_def_statement(new ident_list(id), null, iv, sc)) + public var_statement(ident id, expression iv, SourceContext sc) : this(new var_def_statement(new ident_list(id,id.source_context), null, iv, sc),sc) { } diff --git a/SyntaxVisitors/SugarVisitors/AssignTuplesDesugarVisitor.cs b/SyntaxVisitors/SugarVisitors/AssignTuplesDesugarVisitor.cs index 878dbf0b0..9b38bb33b 100644 --- a/SyntaxVisitors/SugarVisitors/AssignTuplesDesugarVisitor.cs +++ b/SyntaxVisitors/SugarVisitors/AssignTuplesDesugarVisitor.cs @@ -107,10 +107,12 @@ namespace SyntaxVisitors.SugarVisitors var n = assvartup.idents.idents.Count(); for (var i = 0; i < n; i++) { + var sc = assvartup.idents.idents[i].source_context; var a = new var_statement(assvartup.idents.idents[i], - //new dot_node(new ident(tname), new ident("Item" + (i + 1).ToString())), - new semantic_ith_element_of(new ident(tname, assvartup.expr.source_context), new int32_const(i), assvartup.expr.source_context), - assvartup.idents.idents[i].source_context); + //new dot_node(new ident(tname), new ident("Item" + (i + 1).ToString(),sc)), + new semantic_ith_element_of(new ident(tname, assvartup.expr.source_context), new int32_const(i,sc), assvartup.expr.source_context), + sc); + //a.source_context = assvartup.idents.idents[i].source_context; sl.Add(a); } ReplaceStatementUsingParent(assvartup, sl); diff --git a/TestSuite/CompilationSamples/School.pas b/TestSuite/CompilationSamples/School.pas index 2d8fd02d3..9dd3f77e5 100644 --- a/TestSuite/CompilationSamples/School.pas +++ b/TestSuite/CompilationSamples/School.pas @@ -554,7 +554,8 @@ begin n := Abs(n); // foolproof var L := new List; L.Add(1); - L.Add(n); + if n > 1 then + L.Add(n); if n > 3 then begin var k := 2; diff --git a/TestSuite/CompilationSamples/graph3d.pas b/TestSuite/CompilationSamples/graph3d.pas index c9e28cf32..bcf91e777 100644 --- a/TestSuite/CompilationSamples/graph3d.pas +++ b/TestSuite/CompilationSamples/graph3d.pas @@ -3424,6 +3424,12 @@ procedure SerializeObject3D(filename: string; obj: Object3D); /// Десериализует трёхмерный объект из файла function DeserializeObject3D(filename: string): Object3D; + +/// Отключить стандартные обработчики событий мыши +procedure SystemMouseEventsOff; + +/// Включить стандартные обработчики событий мыши +procedure SystemMouseEventsOn; var // ----------------------------------------------------- @@ -3435,6 +3441,8 @@ var OnMouseUp: procedure(x, y: real; mousebutton: integer); /// Событие перемещения мыши. (x,y) - координаты курсора мыши в момент наступления события, mousebutton = 0, если кнопка мыши не нажата, 1, если нажата левая кнопка мыши, и 2, если нажата правая кнопка мыши OnMouseMove: procedure(x, y: real; mousebutton: integer); + /// Событие вращения колёсика мыши. (x,y) - координаты курсора мыши в момент наступления события, mousebutton = 0, если кнопка мыши не нажата, 1, если нажата левая кнопка мыши, и 2, если нажата правая кнопка мыши; delta<0 - колесо мыши вниз, delta>0 - колесо мыши вверх + OnMouseWheel: procedure(x, y: real; mousebutton,delta: integer); /// Событие нажатия клавиши OnKeyDown: procedure(k: Key); /// Событие отжатия клавиши @@ -4673,6 +4681,19 @@ begin OnDrawFrame := nil; end; +var _SystemMouseEventsEnabled := True; + +procedure SystemMouseEventsOff; +begin + _SystemMouseEventsEnabled := False; +end; + +procedure SystemMouseEventsOn; +begin + _SystemMouseEventsEnabled := True; +end; + + type Graph3DWindow = class(GMainWindow) @@ -4756,6 +4777,8 @@ type mb := 2; if Graph3D.OnMouseDown <> nil then Graph3D.OnMouseDown(p.x, p.y, mb); + if not _SystemMouseEventsEnabled then + e.Handled := True; end; procedure SystemOnMouseUp(sender: Object; e: MouseButtonEventArgs); @@ -4768,6 +4791,8 @@ type mb := 2; if Graph3D.OnMouseUp <> nil then Graph3D.OnMouseUp(p.x, p.y, mb); + if not _SystemMouseEventsEnabled then + e.Handled := True; end; procedure SystemOnMouseMove(sender: Object; e: MouseEventArgs); @@ -4780,13 +4805,31 @@ type mb := 2; if Graph3D.OnMouseMove <> nil then Graph3D.OnMouseMove(p.x, p.y, mb); + if not _SystemMouseEventsEnabled then + e.Handled := True; end; + procedure SystemOnMouseWheel(sender: Object; e: MouseWheelEventArgs); + begin + var mb := 0; + var p := e.GetPosition(hvp); + if e.LeftButton = MouseButtonState.Pressed then + mb := 1 + else if e.RightButton = MouseButtonState.Pressed then + mb := 2; + if Graph3D.OnMouseWheel <> nil then + Graph3D.OnMouseWheel(p.x, p.y, mb, e.Delta); + if not _SystemMouseEventsEnabled then + e.Handled := True; + end; + + procedure InitHandlers; override; begin hvp.PreviewMouseDown += (o, e) -> SystemOnMouseDown(o, e); hvp.PreviewMouseUp += (o, e) -> SystemOnMouseUp(o, e); hvp.PreviewMouseMove += (o, e) -> SystemOnMouseMove(o, e); + hvp.PreviewMouseWheel += (o, e) -> SystemOnMouseWheel(o, e); hvp.PreviewKeyDown += (o, e)-> SystemOnKeyDown(o, e); hvp.PreviewKeyUp += (o, e)-> SystemOnKeyUp(o, e); diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 4b42b5626..9fcc6615b 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -21298,7 +21298,7 @@ namespace PascalABCCompiler.TreeConverter AddError(sem_ex.location, "TUPLE_OR_SEQUENCE_EXPECTED"); var IsTuple = false; var IsSequence = false; - if (t.FullName.StartsWith("System.Tuple")) + if (t.FullName.StartsWith("System.Tuple") && !(t.IsArray)) // ошибка - не проходит, когда есть System.Tuple[,][] т.е. массив туплов!!! IsTuple = true; if (!IsTuple) { diff --git a/bin/Lib/School.pas b/bin/Lib/School.pas index 2d8fd02d3..9dd3f77e5 100644 --- a/bin/Lib/School.pas +++ b/bin/Lib/School.pas @@ -554,7 +554,8 @@ begin n := Abs(n); // foolproof var L := new List; L.Add(1); - L.Add(n); + if n > 1 then + L.Add(n); if n > 3 then begin var k := 2;