diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 19c7a77d8..72d1e99f0 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -12110,7 +12110,7 @@ namespace PascalABCCompiler.TreeConverter } context.top_function.is_overload = true; // SSM 12/08/15 context.last_created_function.symbol_kind = symbol_kind.sk_overload_function; - + bool is_forward = false; for (int i = 0; i < _procedure_attributes_list.proc_attributes.Count; i++) { convertion_data_and_alghoritms.check_node_parser_error(_procedure_attributes_list.proc_attributes[i]); @@ -12138,7 +12138,13 @@ namespace PascalABCCompiler.TreeConverter { AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "ATTRIBUTES_IN_INTERFACE_MEMBER"); } + common_namespace_function_node top_function = context.top_function as common_namespace_function_node; + if (top_function != null && top_function.ConnectedToType != null) + { + AddError(get_location(_procedure_attributes_list.proc_attributes[i]), "FORWARD_EXTENSION_METHODS_NOT_ALLOWED"); + } + is_forward = true; break; } case SyntaxTree.proc_attribute.attr_virtual: @@ -12288,6 +12294,8 @@ namespace PascalABCCompiler.TreeConverter } case proc_attribute.attr_extension: { + if (is_forward) + AddError(get_location(_procedure_attributes_list), "EXTENSIONMETHOD_KEYWORD_NOT_ALLOWED"); if (context.converted_compiled_type != null) AddError(get_location(_procedure_attributes_list), "EXTENSIONMETHOD_KEYWORD_NOT_ALLOWED"); if (in_interface_part) diff --git a/bin/Lng/Eng/SemanticErrors_ib.dat b/bin/Lng/Eng/SemanticErrors_ib.dat index 61ca02b6c..5eb384dce 100644 --- a/bin/Lng/Eng/SemanticErrors_ib.dat +++ b/bin/Lng/Eng/SemanticErrors_ib.dat @@ -120,6 +120,7 @@ INTERFACE_EXPECTED=Interface expected IMPLICIT_EXPLICIT_OPERATOR_EXTENSION_ONLY_FOR_COMPILED_CLASSES_ALLOWED=Operators implicit and explicit can be extended only for classes from another .NET assemblies EXTENSIONMETHOD_KEYWORD_NOT_ALLOWED=extensionmethod is not allowed in this context CANNOT_EXTEND_STANDARD_OPERATORS_FOR_DELEGATE=Can not extend operators +,+=,-,-= for delegates +FORWARD_EXTENSION_METHODS_NOT_ALLOWED=forward attribute can not be applied to extension methods %PREFIX%=COMPILATIONERROR_ UNIT_MODULE_EXPECTED_LIBRARY_FOUND=Unit expected, library found ASSEMBLY_{0}_READING_ERROR=Error by reading assembly '{0}' diff --git a/bin/Lng/Rus/SemanticErrors_ib.dat b/bin/Lng/Rus/SemanticErrors_ib.dat index 2ecffbb38..86f0d460b 100644 --- a/bin/Lng/Rus/SemanticErrors_ib.dat +++ b/bin/Lng/Rus/SemanticErrors_ib.dat @@ -115,6 +115,7 @@ INTERFACE_EXPECTED=Ожидался интерфейс IMPLICIT_EXPLICIT_OPERATOR_EXTENSION_ONLY_FOR_COMPILED_CLASSES_ALLOWED=extension-операторы преобразования типов допустимы только для классов из других сборок .NET EXTENSIONMETHOD_KEYWORD_NOT_ALLOWED=Атрибут extensionmethod недопустим в данном контексте CANNOT_EXTEND_STANDARD_OPERATORS_FOR_DELEGATE=Нельзя раширять операции +,+=,-,-= для делегатов +FORWARD_EXTENSION_METHODS_NOT_ALLOWED=Атрибут forward недопустим для методов расширения %PREFIX%=COMPILATIONERROR_ UNIT_MODULE_EXPECTED_LIBRARY_FOUND=Ожидался модуль, а встречена библиотека ASSEMBLY_{0}_READING_ERROR=Ошибка при чтении сборки '{0}'