Exemple #1
0
        protected TypeElement(IDiscriminatedElement parent, ScopeCategories scope, bool isAbstract, bool isSealed,
                              bool isUnsafe, bool isPartial,
                              bool isStatic) : base(parent)
        {
            if (!FastEnum.IsDefined(scope))
            {
                throw new ArgumentOutOfRangeException(nameof(scope));
            }

            if (isAbstract && (isStatic || isSealed))
            {
                throw new ArgumentException(
                          $"If {nameof(isAbstract)} is true then {nameof(isStatic)} or {nameof(isSealed)} can't true.");
            }
            if (isStatic && isSealed)
            {
                throw new ArgumentException($"{nameof(isStatic)} and {nameof(isSealed)} status are conflicted.");
            }

            IsAbstract = isAbstract;
            IsSealed   = isSealed;
            Scope      = scope;
            IsUnsafe   = isUnsafe;
            IsPartial  = isPartial;
            IsStatic   = isStatic;
        }
Exemple #2
0
 public IdentityElement(QualifiedElement from, ScopeCategories scope, IdentityCategories category, string name) : base(from)
 {
     if (!category.IsDefined())
     {
         throw new ArgumentException($"{nameof(category)}:{category} is unexpected value");
     }
     if (!scope.IsDefined())
     {
         throw new ArgumentException($"{nameof(scope)}:{scope} is unexpected value.");
     }
     Category = category;
     Name     = name;
     Scope    = scope;
 }
Exemple #3
0
 public InterfaceElement(IDiscriminatedElement parent, ScopeCategories scope, bool isUnsafe, bool isPartial) :
     base(parent, scope, true, false, isUnsafe, isPartial, false)
 {
 }
 protected override bool TryGenerate(string path, string nameSpace, ScopeCategories scope, bool isAbstract,
                                     bool isSealed, bool isUnsafe,
                                     bool isPartial, bool isStatic, string identity,
                                     out (IPhysicalStorage expectedStorage, NameSpaceElement expectedNameSpace, IQualified expectedIdentity,
 static string encodeScope(ScopeCategories scope) => scope switch
 {
 static void GenerateRecord(string filepath, ScopeCategories scope, IdentityCategories entityCategory, int depth,
                            string name, bool isUnsafe, bool isPartial, bool isStatic, bool isAbstract, bool isSealed,
                            string fullQualified, string parent, StreamWriter writer)
 {
Exemple #7
0
                        isSealed) ParseModifiers(
            SyntaxTokenList list)
        {
            bool isPublic    = false;
            bool isInternal  = false;
            bool isProtected = false;
            bool isPrivate   = false;

            bool isUnsafe   = false;
            bool isPartial  = false;
            bool isStatic   = false;
            bool isAbstract = false;
            bool isSealed   = false;


            foreach (var elem in list)
            {
                if (elem.Text == "public")
                {
                    isPublic = true;
                }
                else if (elem.Text == "private")
                {
                    isPrivate = true;
                }
                else if (elem.Text == "internal")
                {
                    isInternal = true;
                }
                else if (elem.Text == "protected")
                {
                    isProtected = true;
                }
                else if (elem.Text == "unsafe")
                {
                    isUnsafe = true;
                }
                else if (elem.Text == "partial")
                {
                    isPartial = true;
                }
                else if (elem.Text == "static")
                {
                    isStatic = true;
                }
                else if (elem.Text == "abstract")
                {
                    isAbstract = true;
                }
                else if (elem.Text == "sealed")
                {
                    isSealed = true;
                }
            }

            ScopeCategories scope;

            if (isPublic)
            {
                scope = ScopeCategories.Public;
            }
            else if (isInternal)
            {
                scope = isProtected ? ScopeCategories.ProtectedInternal : ScopeCategories.Internal;
            }
            else if (isProtected)
            {
                scope = isPrivate ? ScopeCategories.PrivateProtected : ScopeCategories.Protected;
            }
            else
            {
                scope = ScopeCategories.Private;
            }

            return(scope, isUnsafe, isPartial, isStatic, isAbstract, isSealed);
        }
 public EnumElement(IDiscriminatedElement parent, ScopeCategories scope) : base(parent, scope, false, true,
                                                                                false, false, false)
 {
 }
Exemple #9
0
 public ClassElement(IDiscriminatedElement parent, ScopeCategories scope, bool isAbstract, bool isSealed,
                     bool isUnsafe, bool isPartial, bool isStatic) : base(parent, scope, isAbstract, isSealed, isUnsafe,
                                                                          isPartial, isStatic)
 {
 }
Exemple #10
0
 public DelegateElement(IDiscriminatedElement parent, ScopeCategories scope, bool isUnsafe) : base(parent, scope,
                                                                                                   false, true,
                                                                                                   isUnsafe, false, false)
 {
 }