From a972270fd0fd8b7c4586d4219b77b9542c9727ca Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Tue, 26 May 2020 00:13:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BD=D0=B5=D1=82=D0=BE=D1=87=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B2=20=D1=86=D0=B8=D0=BA=D0=BB=D0=B5=20for=20var=20?= =?UTF-8?q?i:=3Df1()=20to=20f2()=20do?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 4 ++-- Release/pabcversion.txt | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/CompilationSamples/GraphWPF.pas | 9 ++++----- .../SyntaxTreeVisitorNodes/ForLoop.cs | 16 +++++++++++----- bin/Lib/GraphWPF.pas | 9 ++++----- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 116af32f5..9843da4b1 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 = "6"; public const string Build = "3"; - public const string Revision = "2486"; + public const string Revision = "2487"; 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 6300691f4..66bd82b20 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=3 -%REVISION%=2486 %MINOR%=6 +%REVISION%=2487 +%COREVERSION%=3 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 9cf1f3be0..6618cbfa1 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.6.3.2486 +3.6.3.2487 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index f7afe63aa..eef0f59de 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.6.3.2486' +!define VERSION '3.6.3.2487' diff --git a/TestSuite/CompilationSamples/GraphWPF.pas b/TestSuite/CompilationSamples/GraphWPF.pas index 2496d4ee8..2b9dcd9d7 100644 --- a/TestSuite/CompilationSamples/GraphWPF.pas +++ b/TestSuite/CompilationSamples/GraphWPF.pas @@ -42,8 +42,9 @@ type GPen = System.Windows.Media.Pen; /// Тип точки Point = System.Windows.Point; - /// Тип точки + /// Тип вектора GPoint = System.Windows.Point; + Vector = System.Windows.Vector; GBrush = System.Windows.Media.Brush; /// Тип стиля шрифта FontStyle = (Normal,Bold,Italic,BoldItalic); @@ -236,7 +237,7 @@ type //>> Класс Vector # Vector class // ----------------------------------------------------- /// Класс Vector - Vector = class + {Vector = class public x,y: real; /// Создаёт вектор с указанными координатами @@ -246,9 +247,7 @@ type static function operator*(r: real; v: Vector): Vector := new Vector(r*v.x,r*v.y); static function operator+(v: Vector; p: Point): Point := new Point(p.x+v.x,p.y+v.y); static function operator+(p: Point; v: Vector): Point := new Point(p.x+v.x,p.y+v.y); - //static function operator implicit(t: (real,real)): Vector := new Vector(t[0],t[1]); - //static function operator implicit(t: (integer,integer)): Vector := new Vector(t[0],t[1]); - end; + end;} //{{{--doc: Конец секции 2 }}} diff --git a/TreeConverter/TreeConversion/SyntaxTreeVisitorNodes/ForLoop.cs b/TreeConverter/TreeConversion/SyntaxTreeVisitorNodes/ForLoop.cs index d07f27036..34ce77f99 100644 --- a/TreeConverter/TreeConversion/SyntaxTreeVisitorNodes/ForLoop.cs +++ b/TreeConverter/TreeConversion/SyntaxTreeVisitorNodes/ForLoop.cs @@ -58,6 +58,8 @@ namespace PascalABCCompiler.TreeConverter initialValue = tmp; statements_list head_stmts = new statements_list(loopVariableLocation); convertion_data_and_alghoritms.statement_list_stack_push(head_stmts); + + var early_init_loop_variable = false; // SSM 25/05/16 if (_for_node.type_name == null && !_for_node.create_loop_variable) { definition_node dn = context.check_name_node_type(_for_node.loop_variable.name, loopVariableLocation, @@ -83,6 +85,7 @@ namespace PascalABCCompiler.TreeConverter check_for_type_allowed(tn, get_location(_for_node.type_name)); vdn = context.add_var_definition(_for_node.loop_variable.name, get_location(_for_node.loop_variable), tn, initialValue/*, polymorphic_state.ps_common*/); vdn.polymorphic_state = polymorphic_state.ps_common; + early_init_loop_variable = true; // SSM 25/05/16 } internal_interface ii = vdn.type.get_internal_interface(internal_interface_kind.ordinal_interface); if (ii == null) @@ -103,11 +106,14 @@ namespace PascalABCCompiler.TreeConverter res = find_operator(compiler_string_consts.assign_name, left, right, finishValueLocation); head_stmts.statements.AddElement(res); - left = create_variable_reference(vdn, loopVariableLocation); - right = initialValue; - res = find_operator(compiler_string_consts.assign_name, left, right, loopVariableLocation); - head_stmts.statements.AddElement(res); - + if (!early_init_loop_variable) // SSM 25/05/16 - for var i := f1() to f2() do без этой правки дважды вызывал f1() + { + left = create_variable_reference(vdn, loopVariableLocation); + right = initialValue; + res = find_operator(compiler_string_consts.assign_name, left, right, loopVariableLocation); + head_stmts.statements.AddElement(res); + } + location initialValueLocation = get_location(_for_node.initial_value); diff --git a/bin/Lib/GraphWPF.pas b/bin/Lib/GraphWPF.pas index 6ba025bee..7d04a496e 100644 --- a/bin/Lib/GraphWPF.pas +++ b/bin/Lib/GraphWPF.pas @@ -42,8 +42,9 @@ type GPen = System.Windows.Media.Pen; /// Тип точки Point = System.Windows.Point; - /// Тип точки + /// Тип вектора GPoint = System.Windows.Point; + Vector = System.Windows.Vector; GBrush = System.Windows.Media.Brush; /// Тип стиля шрифта FontStyle = (Normal,Bold,Italic,BoldItalic); @@ -236,7 +237,7 @@ type //>> Класс Vector # Vector class // ----------------------------------------------------- /// Класс Vector - Vector = class + {Vector = class public x,y: real; /// Создаёт вектор с указанными координатами @@ -246,9 +247,7 @@ type static function operator*(r: real; v: Vector): Vector := new Vector(r*v.x,r*v.y); static function operator+(v: Vector; p: Point): Point := new Point(p.x+v.x,p.y+v.y); static function operator+(p: Point; v: Vector): Point := new Point(p.x+v.x,p.y+v.y); - //static function operator implicit(t: (real,real)): Vector := new Vector(t[0],t[1]); - //static function operator implicit(t: (integer,integer)): Vector := new Vector(t[0],t[1]); - end; + end;} //{{{--doc: Конец секции 2 }}}