/// <summary>
        /// Gets the export status of a feature in the class that implements it.
        /// </summary>
        /// <param name="sourceClass">The class implementing the feature.</param>
        public virtual CSharpExports GetExportStatus(ICSharpClass sourceClass)
        {
            bool IsExportedToClient;

            IFeature AsFeature = Source as IFeature;

            Debug.Assert(AsFeature != null);

            IIdentifier Identifier       = (IIdentifier)AsFeature.ExportIdentifier;
            string      ExportIdentifier = Identifier.ValidText.Item;

            if (ExportIdentifier == "All")
            {
                IsExportedToClient = true;
            }

            else if (ExportIdentifier == "None" || ExportIdentifier == "Self")
            {
                IsExportedToClient = false;
            }

            else
            {
                FeatureName.TableContain(Owner.Source.ExportTable, ExportIdentifier, out IFeatureName ExportName, out ISealableDictionary <string, IClass> ExportList);
                Debug.Assert(ExportList.Count > 0);

                if (ExportList.Count > 1)
                {
                    IsExportedToClient = true;
                }
                else
                {
                    if (ExportList.ContainsKey(sourceClass.ValidClassName))
                    {
                        IsExportedToClient = false; // Export to self = self + descendant = protected
                    }
                    else
                    {
                        IsExportedToClient = true; // export to another = export to all = public
                    }
                }
            }

            if (IsExportedToClient)
            {
                return(CSharpExports.Public);
            }

            else if (AsFeature.Export == BaseNode.ExportStatus.Exported)
            {
                return(CSharpExports.Protected);
            }
            else
            {
                return(CSharpExports.Private);
            }
        }
示例#2
0
        private static CSharpExports GetExportStatus(IFeatureName name, IClass sourceClass, ISealableDictionary <IFeatureName, ISealableDictionary <string, IClass> > exportTable, IFeature sourceFeature)
        {
            bool IsExportedToClient;

            string FeatureExport = sourceFeature.ExportIdentifier.Text;

            if (FeatureExport == "All")
            {
                IsExportedToClient = true;
            }

            else if (FeatureExport == "None" || FeatureExport == "Self")
            {
                IsExportedToClient = false;
            }

            else
            {
                bool IsExported = FeatureName.TableContain(exportTable, FeatureExport, out IFeatureName ExportName, out ISealableDictionary <string, IClass> ExportList);
                Debug.Assert(IsExported);
                Debug.Assert(ExportList.Count > 0);

                if (ExportList.Count > 1)
                {
                    IsExportedToClient = true;
                }
                else
                {
                    if (ExportList.ContainsKey(sourceClass.ValidClassName))
                    {
                        IsExportedToClient = false; // Export to self = self + descendant = protected
                    }
                    else
                    {
                        IsExportedToClient = true; // export to another = export to all = public
                    }
                }
            }

            if (IsExportedToClient)
            {
                return(CSharpExports.Public);
            }

            else if (sourceFeature.Export == BaseNode.ExportStatus.Exported)
            {
                return(CSharpExports.Protected);
            }
            else
            {
                return(CSharpExports.Private);
            }
        }