diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index fb9dd7bee..d80ecefd6 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 = "4"; public const string Build = "2"; - public const string Revision = "1803"; + public const string Revision = "1804"; 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 428d42c37..434ab3276 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=2 -%REVISION%=1803 %MINOR%=4 +%REVISION%=1804 +%COREVERSION%=2 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index afc7f8b2a..a6dff4734 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.4.2.1803' +!define VERSION '3.4.2.1804' diff --git a/SyntaxTree/tree/TreeHelper.cs b/SyntaxTree/tree/TreeHelper.cs index 366f620f2..58a6a063d 100644 --- a/SyntaxTree/tree/TreeHelper.cs +++ b/SyntaxTree/tree/TreeHelper.cs @@ -750,6 +750,8 @@ namespace PascalABCCompiler.SyntaxTree if (parameters != null) sb.Append("(" + parameters.ToString() + ")"); sb.Append(";"); + foreach (var pa in this.proc_attributes.proc_attributes) + sb.Append(" " + pa.ToString() + " "); return sb.ToString(); } } diff --git a/SyntaxTreeConverters/StandardSyntaxConverter.cs b/SyntaxTreeConverters/StandardSyntaxConverter.cs index 3519799f2..e46c6703f 100644 --- a/SyntaxTreeConverters/StandardSyntaxConverter.cs +++ b/SyntaxTreeConverters/StandardSyntaxConverter.cs @@ -73,14 +73,14 @@ namespace PascalABCCompiler.SyntaxTreeConverters cv.ProcessNode(root); cv.Output(@"Light1.txt");*/ - /*try + try { - //root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz4.txt")); + root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz4.txt")); } catch { - }*/ + } #endif return root; diff --git a/SyntaxVisitors/YieldVisitors/ProcessYieldsCapturedVars.cs b/SyntaxVisitors/YieldVisitors/ProcessYieldsCapturedVars.cs index f768028a0..216bd65ce 100644 --- a/SyntaxVisitors/YieldVisitors/ProcessYieldsCapturedVars.cs +++ b/SyntaxVisitors/YieldVisitors/ProcessYieldsCapturedVars.cs @@ -223,6 +223,7 @@ namespace SyntaxVisitors //function_header nfh = ObjectCopier.Clone(fh); function_header nfh = fh.TypedClone(); + nfh.proc_attributes.proc_attributes.RemoveAll(pat => pat.attribute_type == proc_attribute.attr_override); //function_header nfh = new function_header(); //nfh.name = new method_name(fh.name.meth_name.name); @@ -614,6 +615,8 @@ namespace SyntaxVisitors //var pdCloned = ObjectCopier.Clone(pd); var pdCloned = (procedure_definition)pd.Clone(); + pdCloned.proc_header.proc_attributes.proc_attributes.RemoveAll(pat => pat.attribute_type == proc_attribute.attr_override); + pdCloned.has_yield = false; @@ -658,6 +661,8 @@ namespace SyntaxVisitors // frninja 05/06/16 - фиксим source_context pd.proc_header.name.meth_name.source_context); // = new method_name("" + pd.proc_header.className.meth_name.className); + //pdCloned.proc_header.proc_attributes.proc_attributes.RemoveAll(pat => pat.attribute_type == proc_attribute.attr_override); + InsertHelperMethod(pd, pdCloned); // SSM 13.07.16 - вызов этого метода можно не добавлять } @@ -915,7 +920,7 @@ namespace SyntaxVisitors public override void visit(procedure_definition pd) { - // frninja 14/06/16 - проверяем наличие yield у вложенных методов (и запрещаем ) + // frninja 14/06/16 - проверяем наличие yield у вложенных методов (и запрещаем) CheckInnerMethodsWithYield(pd); if (!pd.has_yield) diff --git a/TestSuite/yield_override.pas b/TestSuite/yield_override.pas new file mode 100644 index 000000000..3239256e2 --- /dev/null +++ b/TestSuite/yield_override.pas @@ -0,0 +1,17 @@ +type + t1=abstract class + public + //i: integer := 1; + function f1:sequence of t1; abstract; + end; + t2=class(t1) + public + function f1:sequence of t1; override; + begin + yield nil; + end; + end; + +begin + Assert(t2.Create.f1.First = nil); +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 9e7cde735..74da50e88 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -13228,7 +13228,8 @@ namespace PascalABCCompiler.TreeConverter } case SyntaxTree.proc_attribute.attr_forward: { - if (with_class_name) AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "DIRECTIVE_{0}_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name); + if (with_class_name) + AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "DIRECTIVE_{0}_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name); //(ssyy) В интерфейсах аттрибуты недопустимы if (context.converted_type != null && context.converted_type.IsInterface) { @@ -13246,7 +13247,8 @@ namespace PascalABCCompiler.TreeConverter case SyntaxTree.proc_attribute.attr_virtual: { - if (with_class_name) AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "DIRECTIVE_{0}_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name); + if (with_class_name) + AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "DIRECTIVE_{0}_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name); //(ssyy) В интерфейсах аттрибуты недопустимы if (context.converted_type != null && context.converted_type.IsInterface) { @@ -13286,7 +13288,8 @@ namespace PascalABCCompiler.TreeConverter case SyntaxTree.proc_attribute.attr_override: case SyntaxTree.proc_attribute.attr_reintroduce: { - if (with_class_name) AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "DIRECTIVE_{0}_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name); + if (with_class_name) + AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "DIRECTIVE_{0}_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name); //(ssyy) В интерфейсах аттрибуты недопустимы if (context.converted_type != null && context.converted_type.IsInterface) { @@ -13365,7 +13368,8 @@ namespace PascalABCCompiler.TreeConverter } case SyntaxTree.proc_attribute.attr_abstract: { - if (with_class_name) AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "DIRECTIVE_{0}_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name); + if (with_class_name) + AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "DIRECTIVE_{0}_NOT_ALLOWED", _procedure_attributes_list.proc_attributes[i].name); if (context.converted_type != null && context.converted_type.IsInterface) { AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "ATTRIBUTES_IN_INTERFACE_MEMBER");