private bool GetIsExport(ParserStateValues state, out ExportedClass exportedClass)
        {
            if (!this.ExtractMethodParts(state))
            {
                exportedClass = (ExportedClass)null;
                return(false);
            }
            bool flag1 = this.Exports.ClassesByName.TryGetValue(state.ClassNames.Peek(), out exportedClass) && exportedClass != null;
            List <ExportedMethod> exportedMethodList1 = (List <ExportedMethod>)null;

            if (flag1 && exportedClass.HasGenericContext)
            {
                if (exportedClass.MethodsByName.TryGetValue(state.Method.Name, out exportedMethodList1))
                {
                    exportedMethodList1.ForEach((Action <ExportedMethod>)(method => this.Notify(2, DllExportLogginCodes.ExportInGenericType, Resources.The_type_1_cannot_export_the_method_2_as_0_because_it_is_generic_or_is_nested_within_a_generic_type, (object)method.ExportName, (object)method.ExportedClass.FullTypeName, (object)method.MemberName)));
                }
                return(false);
            }
            bool flag2 = flag1 && exportedClass.MethodsByName.TryGetValue(state.Method.Name, out exportedMethodList1);

            if (flag1 && !flag2)
            {
                ExportedMethod duplicateExport = this.Exports.GetDuplicateExport(exportedClass.FullTypeName, state.Method.Name);
                this.ValidateExportNameAndLogError(duplicateExport, state);
                if (duplicateExport != null)
                {
                    this.Notify(state, 1, DllExportLogginCodes.AmbigiguousExportName, Resources.Ambiguous_export_name_0_on_1_2_, (object)duplicateExport.ExportName, (object)duplicateExport.ExportedClass.FullTypeName, (object)duplicateExport.MemberName);
                }
            }
            else
            {
                List <ExportedMethod> exportedMethodList2;
                if ((exportedMethodList2 = exportedMethodList1 ?? exportedClass.NullSafeCall <ExportedClass, List <ExportedMethod> >((Func <ExportedClass, List <ExportedMethod> >)(i => i.Methods))) != null)
                {
                    foreach (ExportedMethod exportedMethod in exportedMethodList2)
                    {
                        if (!exportedMethod.IsStatic)
                        {
                            flag2 = false;
                            this.Notify(state, 2, DllExportLogginCodes.MethodIsNotStatic, Resources.The_method_1_2_is_not_static_export_name_0_, (object)exportedMethod.ExportName, (object)exportedMethod.ExportedClass.FullTypeName, (object)exportedMethod.MemberName);
                        }
                        if (exportedMethod.IsGeneric)
                        {
                            flag2 = false;
                            this.Notify(state, 2, DllExportLogginCodes.ExportOnGenericMethod, Resources.The_method_1_2_is_generic_export_name_0_Generic_methods_cannot_be_exported_, (object)exportedMethod.ExportName, (object)exportedMethod.ExportedClass.FullTypeName, (object)exportedMethod.MemberName);
                        }
                    }
                }
            }
            return(flag2);
        }
 private ExportedMethod GetExportedMethod(ParserStateValues state, ExportedClass exportedClass)
 {
     //TODO: see details in NextExportedMethod()
     return(exportedClass.NextExportedMethod(state.Method.Name));
 }
Пример #3
0
 public ExportedMethod(ExportedClass exportedClass)
 {
     this._ExportedClass = exportedClass;
 }