diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index e6499f410..7f4ca542f 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 = "2"; - public const string Revision = "2809"; + public const string Revision = "2814"; 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 87893cd1b..78ee1fff7 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=7 -%REVISION%=2809 %COREVERSION%=2 +%REVISION%=2814 +%MINOR%=7 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index c7e7f7727..4f8e22e4d 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.7.2.2809 +3.7.2.2814 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 49a251305..20a283e0e 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.7.2.2809' +!define VERSION '3.7.2.2814' diff --git a/TestSuite/CompilationSamples/GraphWPF.pas b/TestSuite/CompilationSamples/GraphWPF.pas index 752072d0c..9180fcb5d 100644 --- a/TestSuite/CompilationSamples/GraphWPF.pas +++ b/TestSuite/CompilationSamples/GraphWPF.pas @@ -1620,6 +1620,11 @@ begin var sz := Size(host.DataContext); + if sz.Width = 0 then + sz.Width := GraphWindow.Width; + if sz.Height = 0 then + sz.Height := GraphWindow.Height; + var bmp := new RenderTargetBitmap(Round(sz.Width*scalex), Round(sz.Height*scaley), dpiX, dpiY, PixelFormats.Pbgra32); var myvis := new DrawingVisual(); diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 11d30d2e9..90601d577 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -625,8 +625,8 @@ type static function operator in(x: integer; r: IntRange): boolean := (x >= r.l) and (x <= r.h); static function operator in(x: real; r: IntRange): boolean := (x >= r.l) and (x <= r.h); static function operator=(r1,r2: IntRange): boolean := (r1.l = r2.l) and (r1.h = r2.h); - - function IsEmpty: boolean := l<=h; + /// Возвращает True если диапазон пуст + function IsEmpty: boolean := l>h; function Step(n: integer): sequence of integer; function Reverse: sequence of integer; @@ -698,7 +698,8 @@ type static function operator in(x: char; r: CharRange): boolean := (x >= r.l) and (x <= r.h); static function operator=(r1,r2: CharRange): boolean := (r1.l = r2.l) and (r1.h = r2.h); - function IsEmpty: boolean := l<=h; + /// Возвращает True если диапазон пуст + function IsEmpty: boolean := l>h; function Step(n: integer): sequence of char; function Reverse: sequence of char; @@ -764,7 +765,8 @@ type static function operator in(x: real; r: RealRange): boolean := (x >= r.l) and (x <= r.h); static function operator=(r1,r2: RealRange): boolean := (r1.l = r2.l) and (r1.h = r2.h); - function IsEmpty: boolean := l<=h; + /// Возвращает True если диапазон пуст + function IsEmpty: boolean := l>h; function ToString: string; override := $'{l}..{h}'; function Equals(o: Object): boolean; override; @@ -7844,6 +7846,11 @@ end; function DeleteFile(fname: string): boolean; begin + if not &File.Exists(fname) then + begin + Result := False; + exit + end; try Result := True; &File.Delete(fname); diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index fd661c03b..61f8fe37f 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -20027,6 +20027,9 @@ namespace PascalABCCompiler.TreeConverter int err_cnt = ErrorsList.Count; try { + expression_node yyy; + if (ff.parameters.expressions.Count > 0) + yyy = convert_strong(ff.parameters.expressions[0]); qq = convert_strong(ff.dereferencing_value); if (qq is exit_procedure && stl.list.Count == 1 || qq is local_block_variable_reference && qq.type is compiled_type_node && (qq.type as compiled_type_node).compiled_type == typeof(Action)) { @@ -20141,9 +20144,11 @@ namespace PascalABCCompiler.TreeConverter var s = new string (' ',ccc)+"begin " + _function_lambda_definition.lambda_name + " " + _function_lambda_definition.parameters.expressions[0] + "\n"; ccc += 2; System.IO.File.AppendAllText("d:\\bb3.txt", s); - }*/ + }*/ #endif - MaybeConvertFunctionLambdaDefinitionToProcedureLambdaDefinition(_function_lambda_definition); + //stl.list[0] = new procedure_call(ff, ff.source_context); - Это надо для превращения функции в процедуру + //_function_lambda_definition.return_type = null; + _function_lambda_definition.RealSemTypeOfResExpr = null; // После первого присваивания Result она будет содержать тип type_node в правой части Result _function_lambda_definition.RealSemTypeOfResult = null; @@ -20166,11 +20171,29 @@ namespace PascalABCCompiler.TreeConverter } return; } - - Func makeProcedureForLambdaAndVisit = ProcedureForLambdaAndVisit; + // Внутри makeProcedureForLambdaAndVisit делается procdecl или funcdecl и обходится. + // Поэтому формальный параметр обходится точно!! + //Func makeProcedureForLambdaAndVisit = ProcedureForLambdaAndVisit; switch (lambdaProcessingState) { + case LambdaProcessingState.TypeInferencePhase: + { + MaybeConvertFunctionLambdaDefinitionToProcedureLambdaDefinition(_function_lambda_definition); + if (_function_lambda_definition.lambda_visit_mode == + LambdaVisitMode.VisitForAdvancedMethodCallProcessing) + { + ProcedureForLambdaAndVisit(_function_lambda_definition, null, null); + if (!LambdaHelper.IsAuxiliaryLambdaName(_function_lambda_definition.lambda_name)) + { + LambdaHelper.RemoveLambdaInfoFromCompilationContext(context, _function_lambda_definition); + } + } + + ret.return_value((semantic_node)LambdaHelper.GetTempFunctionNodeForTypeInference(_function_lambda_definition, this)); + + break; + } case LambdaProcessingState.FinishPhase: { if (context.top_function != null && context.top_function.generic_params != null) @@ -20205,32 +20228,16 @@ namespace PascalABCCompiler.TreeConverter } } - var methodNameToVisit = (ident_with_templateparams)makeProcedureForLambdaAndVisit(_function_lambda_definition, new ident_list(pars), whereSection); + var methodNameToVisit = (ident_with_templateparams)ProcedureForLambdaAndVisit(_function_lambda_definition, new ident_list(pars), whereSection); _function_lambda_definition.substituting_node = methodNameToVisit; visit(methodNameToVisit); } else { - var methodNameToVisit = (ident)makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null); + var methodNameToVisit = (ident)ProcedureForLambdaAndVisit(_function_lambda_definition, null, null); _function_lambda_definition.substituting_node = methodNameToVisit; visit(methodNameToVisit); } - break; - } - case LambdaProcessingState.TypeInferencePhase: - { - if (_function_lambda_definition.lambda_visit_mode == - LambdaVisitMode.VisitForAdvancedMethodCallProcessing) - { - makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null); - if (!LambdaHelper.IsAuxiliaryLambdaName(_function_lambda_definition.lambda_name)) - { - LambdaHelper.RemoveLambdaInfoFromCompilationContext(context, _function_lambda_definition); - } - } - - ret.return_value((semantic_node)LambdaHelper.GetTempFunctionNodeForTypeInference(_function_lambda_definition, this)); - break; } case LambdaProcessingState.ClosuresProcessingPhase: @@ -20239,21 +20246,21 @@ namespace PascalABCCompiler.TreeConverter //var s = "begin "+_function_lambda_definition.lambda_name + " "+ _function_lambda_definition.parameters.expressions[0] + "\n"; //System.IO.File.AppendAllText("d:\\bb17.txt", s); #endif - makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null); + ProcedureForLambdaAndVisit(_function_lambda_definition, null, null); LambdaHelper.RemoveLambdaInfoFromCompilationContext(context, _function_lambda_definition); ret.return_value((semantic_node)LambdaHelper.GetTempFunctionNodeForTypeInference(_function_lambda_definition, this)); break; } case LambdaProcessingState.ClosuresProcessingVisitGeneratedClassesPhase: { - makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null); + ProcedureForLambdaAndVisit(_function_lambda_definition, null, null); break; } case LambdaProcessingState.None: { if (context.converting_block() == block_type.namespace_block) { - var methodNameToVisit = (ident)makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null); + var methodNameToVisit = (ident)ProcedureForLambdaAndVisit(_function_lambda_definition, null, null); _function_lambda_definition.substituting_node = methodNameToVisit; visit(methodNameToVisit); } diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 11d30d2e9..90601d577 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -625,8 +625,8 @@ type static function operator in(x: integer; r: IntRange): boolean := (x >= r.l) and (x <= r.h); static function operator in(x: real; r: IntRange): boolean := (x >= r.l) and (x <= r.h); static function operator=(r1,r2: IntRange): boolean := (r1.l = r2.l) and (r1.h = r2.h); - - function IsEmpty: boolean := l<=h; + /// Возвращает True если диапазон пуст + function IsEmpty: boolean := l>h; function Step(n: integer): sequence of integer; function Reverse: sequence of integer; @@ -698,7 +698,8 @@ type static function operator in(x: char; r: CharRange): boolean := (x >= r.l) and (x <= r.h); static function operator=(r1,r2: CharRange): boolean := (r1.l = r2.l) and (r1.h = r2.h); - function IsEmpty: boolean := l<=h; + /// Возвращает True если диапазон пуст + function IsEmpty: boolean := l>h; function Step(n: integer): sequence of char; function Reverse: sequence of char; @@ -764,7 +765,8 @@ type static function operator in(x: real; r: RealRange): boolean := (x >= r.l) and (x <= r.h); static function operator=(r1,r2: RealRange): boolean := (r1.l = r2.l) and (r1.h = r2.h); - function IsEmpty: boolean := l<=h; + /// Возвращает True если диапазон пуст + function IsEmpty: boolean := l>h; function ToString: string; override := $'{l}..{h}'; function Equals(o: Object): boolean; override; @@ -7844,6 +7846,11 @@ end; function DeleteFile(fname: string): boolean; begin + if not &File.Exists(fname) then + begin + Result := False; + exit + end; try Result := True; &File.Delete(fname);