From eee4a4e860db84875f1c30a1be67d360792d18b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Mon, 19 Aug 2019 21:10:29 +0200 Subject: [PATCH] bug fix #2078 --- Compiler/PCU/PCUWriter.cs | 7 +++++-- NETGenerator/NETGenerator.cs | 10 ++++++---- TreeConverter/TreeConversion/syntax_tree_visitor.cs | 3 +-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Compiler/PCU/PCUWriter.cs b/Compiler/PCU/PCUWriter.cs index 4fb5d3ac5..f5d8e373f 100644 --- a/Compiler/PCU/PCUWriter.cs +++ b/Compiler/PCU/PCUWriter.cs @@ -3050,7 +3050,7 @@ namespace PascalABCCompiler.PCU //else //{ // bw.Write((byte)1); - if (meth.function_code == null) + if (meth.function_code == null || meth.name.IndexOf("") != -1) { VisitStatement(new empty_statement(null)); } @@ -3071,7 +3071,10 @@ namespace PascalABCCompiler.PCU //(ssyy) метки VisitLabelDeclarations(func.label_nodes_list); FixupCode(func); - VisitStatement(func.function_code); + if (func.name.IndexOf("") != -1) + VisitStatement(new empty_statement(null)); + else + VisitStatement(func.function_code); } private void VisitNestedFunctionImplementation(common_in_function_function_node func) diff --git a/NETGenerator/NETGenerator.cs b/NETGenerator/NETGenerator.cs index 6979cdd95..618f1c7a0 100644 --- a/NETGenerator/NETGenerator.cs +++ b/NETGenerator/NETGenerator.cs @@ -2569,8 +2569,6 @@ namespace PascalABCCompiler.NETGenerator return false; } - - //Ета штуковина все жутко тормозит. особенно генерацию EXE private void AddSpecialDebugVariables() { if (this.add_special_debug_variables) @@ -2610,7 +2608,10 @@ namespace PascalABCCompiler.NETGenerator foreach (ICommonNestedInFunctionFunctionNode f in func.functions_nodes) ConvertFunctionBody(f); //перевод тела - ConvertBody(func.function_code); + if (func.name.IndexOf("") == -1) + ConvertBody(func.function_code); + else + il.Emit(OpCodes.Ret); //ivan for debug if (save_debug_info) { @@ -6100,7 +6101,8 @@ namespace PascalABCCompiler.NETGenerator } else { - ConvertFunctionBody(value, copy_mi, true); + if (value.name.IndexOf("") == -1) + ConvertFunctionBody(value, copy_mi, true); //вызов статического метода-клона //при этом явно передается this il = methb.GetILGenerator(); diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index e8aab695f..0c522fd33 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -4158,8 +4158,7 @@ namespace PascalABCCompiler.TreeConverter { throw new NotSupportedError(get_location(_index_property)); } - - //TODO: Если одного из акцессоров нет? + public override void visit(SyntaxTree.simple_property _simple_property) { if (_simple_property.accessors == null)